When the air near the ground becomes rarer due to temperature difference, the light rays from the object toward the ground keep bending away from the normal as they will continuously be travelling from denser to rarer medium. As the medium gets rarer near the ground, a point comes when total internal reflection occurs at which the direction of the light rays turns upward. When these light rays reach our eyes, they appears to be coming from a closer point. This makes an optical illusion called a mirage.
So, a mirage forms due to varying refractive index of the medium as well as total internal reflection of the light travelling in the medium.
Hence option D is correct.
[1 Mark]