Without getting into salt effects and such, in a very quick and dirty conceptual manner:
Let's say you have a 98% desired product / 2% contaminant product.
Lets say that you have 1g of total product (.98g desired product, .02g contaminant), and that they're both equally soluble to .02g/mL of solvent at a given temperature 0.
Heat up the solvent and dissolve all the solute. Gradually cool it down (to 0) so that they become less soluble and your desired product precipitates out, while your contaminant stays in solution.
If you put them in 1 mL of solvent, .02g of each will dissolve, and the remaining .96g of your desired product will precipitate out.
Of course there's Ksp and such involved here, but in broad strokes that's what's going on.