Nucleation
All crystals form as a result of two processes, called "nucleation" and "crystal growth," in a "supersaturated" liquid solution (a liquid with something dissolved in it; for example, salt). This will occur in a cave if it is flooded with one of these liquid solutions for as long as a hundred thousand years or more. The first step, nucleation, occurs when groups of molecules floating in a solution begin to stick together in stable clusters. Whether a cluster of molecules becomes stable depends on many factors within the solution, including temperature and whether it is "supersaturated."
Supersaturation
Supersaturation occurs when the solution contains more of the dissolving material than it can dissolve. For example, if you continue stirring sugar into a cup of coffee, the liquid will eventually become "saturated" and unable to dissolve any more sugar. Supersaturation would occur if you added yet more sugar until particles were floating in the coffee, unable to be dissolved.
Crystal Growth
The way the molecules stick together during nucleation plays a role in defining the eventual shape of the crystal. Crystal growth occurs when the stable clusters in the solution achieve critical size (the minimum dimensions the crystal molecules must reach to continue growth without disintegrating). Nucleation continues as crystal growth develops beyond critical size and is driven by supersaturation, providing additional molecules to stick to the nucleus of the fledgling crystal. Depending on conditions within the solution, nucleation or crystal growth may be predominant over the other and result in different-size crystals. Crystal growth or nucleation continues until supersaturation is ended or the cave dries completely.
Different Types of Crystal
Many different types of solution have the ability to produce different types of crystal. For example, salt crystals occur when salt is dissolved in water and dried, but other materials dissolved in a solution have the ability to form crystals, too. Gallium and halite are other materials known to crystallize.
Making Your Own Crystals
You can easily form salt crystals at home by adding salt to boiling water until it becomes supersaturated. Use a piece of cardboard to help the crystals form; it does so by providing the salt molecules with a place to nucleate. Place the supersaturated salt solution with the cardboard in the sun until it dries. This will allow small crystals to form.