The factors that generate mineral concentrations are complex and often only partly known
Introduction: geology is complicated
The one thing we can be very certain about is is that the distribution of minerals in the earth's crust has very little to do with the primordial origins of the component elements (that is where they came from in the early solar system and how they were originally generated). Most "heavy" elements are originally formed in the cores of supernovae and not in either the big bang or in normal stars.
The distribution of elements in the earth is mostly unrelated to the cosmic origins of elements because the earth's crust is not static but is frequently churned up by a variety of processes on a geological timescale. If we go back far enough in the history of the planet, everything was molten and this allowed some of the denser components to separate out before the surface cooled enough to be solid. The led to the core being mostly metallic (and consisting of mostly iron and nickel). Higher layers contain less dense minerals containing a lot of silicate minerals. At the top there is a thin layer, the crust, which is where we find useful minerals and it is even more concentrated in silicate minerals and even less dense.
But those early processes are mostly irrelevant to what we see in the crust. The crust is subject to a variety of processes that churn up the content, many of which concentrate specific components.
On a very large scale we have plate tectonics where large arts of the crust are both made and recycled on a geological timescale. To simplify greatly, new continental rock at emerges at one place (eg the mid atlantic ridge) and is consumed by subduction at other plate boundaries (eg the Andean belt in South America).
On a smaller scale (though often related to plate tectonic boundaries) volcanism takes molten rock from relatively deep in the crust and spews it out to the surface, bringing minerals of new compositions to the surface and altering the surrounding minerals by heat and pressure.
Also the surface is subject to weather which causes erosion (leading to both chemical and physical separation of the mineral content of rocks) and the uncovering of rock layers originally formed much deeper in the crust by the cooling of liquid mantle. Another product of erosion is sedimentary rocks where the things being eroded reform into new types of rock.
Plus life itself leads to the creation of some rocks. Some creatures collect carbonate minerals to make their protective bodies, for example, and if these concentrate when they dies, they may deposit layers which over time become new rock types (eg limestone).
To make things even more complicated these processes may interact. Volcanic heat or pressure caused by burial or major stresses may cause major changes to other types of rock, altering their mineral content in the process. Limestone may be recrystallised into marble; plant deposits may be transformed into coal or oil. And other separations are caused by related processes. Metamorphism is often associated with fluid flow which, depending on the composition of the fluid, may move specific minerals around, extracting specific components from some minerals and recrystallising them in voids left by the stresses associated with the metamorphic processes.
In short, things are pretty complicated in the crust and the dynamics will churn things up a lot over geological time. The one thing we can be sure of is that what we see now is not primarily dominated by the primordial origin of the elements.
There are three major processes that concentrate specific ores
I'm going to greatly simplify some of the things that matter here but there are basically three important processes that concentrate things. Not that geologists can typically reach a consensus on what specifically happened with many deposits.
The three processes are:
- separation due to erosion
- separation due to differential crystallisation of liquid rocks
- separation caused by metamorphic processes
Some major mineral deposits of economic importance (such as the Klondyke deposits in Canada) are caused by the first type of process. Some major platinum and related mineral deposits are from similar processes. What is basically happening is that the metals or minerals containing the metals are concentrated by flowing water because they are denser than the bulk of other minerals from the source rock. This is the same process that prospectors practice when panning for gold in rivers (fast flowing water tends to wash away the less dense clay minerals and leave the denser specs of gold). Over a geological time scale this process sometimes leads to very significant concentration of "heavy" minerals. The association depends on the density of the specific minerals and their specific presence in the rock being eroded. But, if the eroding rock contains many dense minerals, then the process can concentrate them all in the alluvial deposit.
But why would some rocks originally contain more than their fair share of specific minerals? One reason is the second geological process that leads to selective concentration of some minerals. This is that, as liquid rocks in the mantle cool, different minerals will crystallise from the mix at different times. a visible manifestation of this process can be seen in many of the polished granites used to decorate kitchen tops or the floors and walls of buildings. Granites consist of three key minerals: feldspars, quartz and mica each with very different mineral contents. The rock is usually formed deep in the crust when a large body of liquid rock cools. But the feldspars crystallise first, giving the large colourful crystals that make the polished surfaces so attractive. Sometimes the large crystals even show patterns of flow in the liquid source rock. The important general point is that the composition of the liquid changes as crystals form and this may concentrate some components. But this process of selective crystallisation is very general and explains why some particular concentrations exist.
The largest concentration of platinum group minerals is in a formation in southern africa called the Merensky "reef". The key concentrations of minerals appear to have been caused by separation as the rock crystallised (according to this book):
“Present opinion is that the Complex was intruded from a magma that was undergoing some differentiation, but was intruded in discontinuous phases. There is an overall trend in the mineralogy and chemistry of the basic rocks that is normal, and the layering of individual rock units is thought to be due to settling out of crystals according to density modified by connection currents flowing in the magma.”
The third process is also important for many valuable minerals. Metamorphic processes, for example, often involve heat and pressure but also hydrostatic processes. The pressure may crack existing rock leaving voids which are filled with high pressure liquid water containing various minerals that can selectively solubilise the contents of the rock and, later, deposit it in the voids. Once chemical property that can selectively separate gold and platinum group metals occurs when the water contains a lot of sulfur, selenium or tellurium and is a reducing environment (eg sufides rather than sulfates). Many precious metals will go into solution in such environments only to be deposited later from the solution as the state changes. Many gold deposits are like this as are some platinum group deposits.
Rare earth (lanthanide-containing) minerals are thought to be concentrated by the same sorts of processes but are, despite rare earths being pretty common in the crust (far more common that precious metals), much less common as economically viable deposits. This may be because the specific chemical process that concentrate them in the first place are less common. This is partially because they have large atomic radii and high charge and that means they don't fit well into the commonest silicate types of mineral. The key minerals they do occur in are carbonate and phosphate based. And these are often thought to occur near locations where continental crust is being consumed at a plate boundary where metamorphic processes may increase the presence of phosphate and carbonate in the resulting rock. See this presentation for some ideas. But they can also be concentrated by sedimentary processes where solutions eroded from source rocks are selectively absorbed into clay minerals elsewhere.
In general the reason why rare earths are found together is that they are chemically similar so there are few natural processes that will separate them (heck, the industrial processes are very hard and expensive).
Summary
There are many processes, both physical and chemical, that can cause concentrations of particular minerals in the earth's crust. Some of these depend on chemistry but others are simple physical processes. But geological chemistry is pretty messy and complicated and, even now, geologists can't always agree what particular process created a deposit. But there are broad types of process that probably contribute some of which depend on the similar chemistry of particular groups of elements. Rare earths are very chemically similar, for example, and precious metals have some chemical similarities (especially solubilisation in reducing environments with sulfur and other group 16 elements) that enable geological processes to concentrate them in some locations.
Some material here is from The Atlas of Economic Mineral Deposits which, though fairly old (1979) is worth a read to get a feel for how complex this subject is.