I have been wondering for a long time why large mineral deposits occur. Magma is a random homogenous mix of many elements, so why would they accumulate specific minerals in one deposit as they cool?
This article explains why. It's a long read but worth it, I think. Here's some excerpts.
"Underground magma, on the other hand, cools and crystallizes slowly, and the resulting igneous rocks tend to contain [larger] mineral grains."
"The crystallization of magma is a complex process because magma is a complex substance. Certain magmas...contain several percent water dissolved in them. When a granitic magma cools, the first minerals to crystallize tend to be anhydrous (e.g., feldspar), so an increasingly water-rich residue remains. Certain rare chemical elements, such as lithium, beryllium, and niobium, that do not readily enter into atomic substitution in the main granite minerals (feldspar, quartz, and mica) become concentrated in the water-rich residual magma."
"If the crystallization process occurs at a depth of about five kilometres or greater, the water-rich residual magma may migrate and form small bodies of igneous rock, satellitic to the main granitic mass, that are enriched in rare elements. Such small igneous bodies, called rare-metal pegmatites...up to one metre across."
"Carbonatites are igneous rocks that consist largely of the carbonate minerals calcite and dolomite...Most carbonatites occur close to intrusions of alkaline igneous rocks (those rich in potassium or sodium relative to their silica contents)...Many carbonatites are mined or contain such large reserves that they will be mined someday."
"Magmatic segregation is a general term referring to any process by which one or more minerals become locally concentrated (segregated) during the cooling and crystallization of a magma. Rocks formed as a result of magmatic segregation are called magmatic cumulates. While a magma may start as a homogeneous liquid, magmatic segregation during crystallization can produce an assemblage of cumulates with widely differing compositions."
"Mineral deposits that are magmatic cumulates are only found in mafic and ultramafic igneous rocks (i.e., rocks that are low in silica). This is due to the control exerted by silica on the viscosity of a magma: the higher the silica content, the more viscous a magma and the more slowly segregation can proceed."
"A different kind of magmatic segregation involves liquid immiscibility. A cooling magma will sometimes precipitate droplets of a second magma that has an entirely different composition. Like oil and water, the two magmas will not mix (i.e., they are immiscible)...when the concentration of a particular mineral within a parent magma reaches saturation, precipitation occurs. If saturation is reached at a temperature above the melting point of the mineral, a drop of liquid precipitates instead of a mineral grain. The composition of this immiscible drop is not exactly that of the pure mineral, because the liquid tends to scavenge and concentrate many elements from the parent magma, and this process can lead to rich ore deposits."
"Iron sulfide is the principal constituent of most immiscible magmas, and the metals scavenged by iron sulfide liquid are copper, nickel, and the platinum group."
"Hydrothermal mineral deposits are those in which hot water serves as a concentrating, transporting, and depositing agent...Hydrothermal deposits are never formed from pure water, because pure water is a poor solvent of most ore minerals. Rather, they are formed by hot brines...Hydrothermal mineral deposits, on the other hand, are neither common nor very large compared to other geologic features."
"The simplest hydrothermal deposit to visualize is a vein, which forms when a hydrothermal solution flows through an open fissure and deposits its dissolved load...Precipitation of the minerals is usually caused by cooling of the hydrothermal solution, by boiling, or by chemical reactions between the solution and rocks lining the fissure."
"Hydrothermal deposits formed at shallow depths below a boiling hot spring system are commonly referred to as epithermal...Epithermal veins tend not to have great vertical continuity, but many are exceedingly rich and deserving of the term bonanza. Many of the famous silver and gold deposits of the western United States, such as Comstock in Nevada and Cripple Creek in Colorado, are epithermal bonanzas."
[The article goes on to describe many other types of hydrothermal deposits...]