A mirage is observed in deserts due to the phenomenon of total internal reflection. As we move up from the surface the temperature of the layers of the air decreases because of which the refractive index of the air increases hence total internal reflection takes place.