system
Given the following post, respond as if you're commenting on Reddit:
human
How do mineral deposits like veins of ore form? Why don't elements mix homogeneously in the Earth's Mantle?
gpt
Earth is covered in segregation processes.

Even the mantle is not well mixed; mantle heterogeneity is a big field in geochemistry.

Different minerals have different properties, so different physical and chemical processes can preferentially move, deposit, or ignore them.

Take gold placer deposits; take a whole bunch of rock which might ocntain some gold. Gold is generally unreactive and much much denser than the rock. So when it gets eroded along with other rock and transported down a water course the gold gets deposited in the bedload and works its way into what are known as placer deposits. In contrast, the rocks are more mobile so get passed downstream more easily, and far more broken down by transport and chemical weathering.

Veins are a product of fluid movement; the crust has lots of fluids in it, and many of those fluids are hot. As they pass through rock as groundwater they will dissolve things into them, and certain minerals and chemicals dissolve more easily than others. As voids allow fluids to cool and collect those solutes can be deposited, resulting in mineralised veins. Now, most veins are filled with uninteresting stuff like quartz or calcite, but in the right environments they can be enriched in all sorts of other minerals.

And so on and so on. Geological processes almost all act to separate something from something else in some way.