system
Given the following post, respond as if you're commenting on Reddit:
human
Geology (and some astronomy) question: Why do we find elements and compounds in veins and generally clumped together in the earth?

Most heavier elements are formed in supernova explosions and float through space as dust until they are coalesced into planets. Does dust of the same element just generally form together and stays close together and so eventually it ends up either clumped up in a single deposit? Or do elements of the same variety have a method of attracting each other in space? Or does the earth have a method of refining these materials where plate tectonics and such make materials of similar masses clump up? 

Essentially I am asking how do heavy elements go from dust in space surrounded by tons of different types of dust to a lump of platinum or uranium in the ground?
gpt
There are mechanisms that essentially sort them.  You see this process on a normal time scale with something like Italian dressing.  :)

The primary mechanisms are density, and melting points.

You have a big pool of mixed elements and compounds just swirling around.  In general the denser liquids will settle to the bottom unless disturbed and stirred up. So if you get a pool somewhere that isn't disturbed much, you'll get layers of different liquids.

As time goes on it cools.  The elements with lowest melting point "freeze" and turn solid, and drift to the bottom as well (solid they are even denser than when liquid).  This forms a layer on the bottom of the deposit, a sheet or "vein" if seen from the side.

As the pool cools further, the next element freezes out, forming it's layer and so on.

The slower the pool of compounds cools, the more time for the different materials to settle out, and more distinct the seperation and layering.  If the area cools quickly you'll get grains rather than layers.  The faster it cools, the smaller the grains.

This is why veins tend to be underground, as the layers of rock help insulate and slow the cooling process, allowing the density sorting to occur.