The brilliance of a diamond and the formation of mirages are both primarily caused by the phenomenon of total internal reflection, which occurs when light travels from a denser to a rarer medium at an angle greater than the critical angle.