The formation of mirage is a result of the refraction and total internal reflection of light in air. Regions of air at different temperatures have different refractive indices just like many different mediums. The closer the air is to the
ground the hotter it will be and its refractive index will be smaller. The figure below shows formation of mirage. Suppose there is an oasis and the light it emits at point A is refracted by the air, the light will travel through the curved path. Total internal reflection occurs at point B and will cause the light
to travel upwards. Then the light is refracted by the air again. At last it will enter the eyes of the observer at point C, producing an illusion that the oasis is close to him.