The idea here is that on the surface of the desert a layer of very hot air introduces a sharp change in direction of solar rays inducing the formation (in our brain) of a virtual image.
I tried to show the effect in the following diagram:
As you can see the interface between cold (denser) and very hot air produces in refraction a sharp bend of the sun rays inducing the observer to form a virtual image using the extension of the rays as coming from a different point!
hope it helps!
See explanation below.
The physical phenomenon of creation of Mirage can be explained with the help of exaggerated line diagram below.
Due to severe heat of the sun in the desert the ground becomes quite hot. The layer of air which is in contact with the ground also gets heated. The heat is gradually passed on to the upper layers of air.
The upper layer above any layer is slightly cooler than the layer below it. Cooler air is denser than the hot air. The refractive index of hotter layer is less than that of the adjacent cooler layer above it.
Assume an object, say a tree, is located far away. A ray of light starts from the object, travels towards the eye passing through points A, B, C, D as shown in the diagram.
At point A. The dotted horizontal line represents the interface between two adjacent layers of air. The full line is the normal at the point of incidence of the ray of light. Since ray of light travels from a denser medium to a rarer medium, it is bent away from the normal due to refraction of light. Similarly at point B. It is bent away from the normal at B.
Somewhere in the path, the angle of incidence becomes larger than the critical angle, and at that point say C, total internal reflection of light occurs and ray is bent upwards, as shown.
Further to this point the ray travels from a rarer medium to a denser medium. And the ray of light, therefore, bends towards the normal due to refraction. See point D.
Finally, the ray enters the eye of the observer.
The eye always thinks that light travels in straight lines.
Therefore, an image of the object, shown by the extended dotted straight line, is formed just below the object.
The image appears to the eye as if it was formed due to reflection of the object in water around. When the observer moves towards and reaches the object, he finds that there no water.
This is Mirage.