In the summer season, it is found that the air closer to the earth’s surface is hotter than the air found above it. This makes the air that is closer to the earth’s surface much rarer that the air found above it. So as we go up from earth’s surface, the air’s refractive index augments as well.
In the diagram, the rays of light emitting from the top of the object (tree) simply go through several layers of air they keep moving farther away from the normal. This thing increases the angle of refraction and when the rays touch the ground they go through total internal reflection. It is this fully reflected ray that reaches our eyes. This shows the image of P as P’, as though it reflection took place due to water. This phenomenon is referred to as mirage.