How did elements created by a merging neutron stars and dying low-mass stars get down to our planet?
The follow up question is, how come the different elements aren't uniformly mixed within the earth. Or perhaps formed into stratified layers with the densest at the centre? E.g. Why are there 'deposits' of gold relatively close to the surface? Something to do with interaction of the physical and chemical properties of the elements with local variations in conditions?
Crustal deposits of heavier minerals largely result from late bombardment (after the crust had formed, about 100 million years after Earth's formation itself), geothermal and tectonic activity (volcanism, rift zones, vents), and biological mobilisation and concentration (e.g., lighter elements in coal and limestone, but notably, banded iron formations). Events such as the hypothesized Tethys collision could of course also have influenced distribution.
Gold forms veins typically in quartzes through differential precipitation AFAIU.
Ore formation is its own fascinating subfield of geology, and is underappreciated by many advocates of space mining.
https://en.wikipedia.org/wiki/Abundance_of_elements_in_Earth...
https://en.wikipedia.org/wiki/Planetary_differentiation