When you poured the salt–sand mixture into the CD case, you should have noticed that it formed an interesting organized pattern of alternating layers of salt and sand. Despite the materials being well combined to start, the two types of particles will always sort themselves like this, as they have different angles of repose—the angle at which the material can no longer support itself.
As the materials are deposited on top of the pile, at some angle, one of the materials will collapse on itself. This creates the layers you observe. Within the layers, the salt always ends up on top of the sand when poured into the CD case. This is an example of the Brazil-nut effect as well as the angle of repose of the different materials (see the Going Further section below to calculate the angle of repose).
Anyone who has ever opened a can of mixed nuts has experienced the Brazil-nut effect. If you shake a can of mixed nuts, the largest nuts—for example, the Brazil nuts—always end up on top. The smaller nuts fall between the cracks created by the larger nuts.
Below is an animated demonstration of the effect, using rice in a plastic container and a red marble. Notice that the marble starts out on top of the pile of rice. If you quickly invert the container and then tip it right side up, the marble will end up under the rice, hidden from view. But shake the container up and down a few times and you'll see the marble begin to rise up through the rice, until finally it is back on top.
This effect is also known as granular convection. In a mixture of granulated materials, smaller particles slip between the spaces created beneath the larger particles as the mixture is shaken. In this Snack, the smaller sand particles slip beneath the larger salt particles, leaving a layer of salt on top of each sand layer in the CD case.
The different sizes, densities, and colors of the materials in the mixture—in this case black sand and salt—are essential, because materials with different characteristics will have different angles of repose and different rates of granular convection.