Crystallization can occur due to the limited solubility of materials in a solvent. Many factors come into play, but ultimately under the right conditions many organic compounds will begin to form organized lattices, or crystals, which are a lower energy state than when dissolved in a supersaturated solution.
By controlling the various factors of the process, the crystals can form with very high concentrations of the target molecule, excluding any impurities. The ability for an organic substance to crystallize is dependent on intramolecular and intermolecular forces. For certain compounds, the result of the solidification may instead form an amorphous solid.