A mirage is an optical phenomenon that creates the illusion of water and results from the refraction of light through a non-uniform medium. Mirages are most commonly observed on sunny days when driving down a roadway. As you drive down the roadway, there appears to be a puddle of water on the road several yards (maybe one-hundred yards) in front of the car. Of course, when you arrive at the perceived location of the puddle, you recognize that the puddle is not there. Instead, the puddle of water appears to be another one-hundred yards in front of you. You could carefully match the perceived location of the water to a roadside object; but when you arrive at that object, the puddle of water is still not on the roadway. The appearance of the water is simply an illusion.
On sunny days as the surface of the earth warms up, the layers of air near to the earth also gets hot.As we move up in the atmosphere, the layers get cooler. so the density of the layers also increases as we go up from the surface of earth.
Light that is traveling downward from the top of the object(as given in the fig,man on the camel)into this less optically dense air begins to speed up. Though there isn't a distinct boundary between two media, there is a change in speed of a light wave. As expected, a change in speed is accompanied by a change in direction. If there were a distinct boundary between two media, then there would be a bending of this light ray away from the normal. For this light ray to bend away from the normal (towards the boundary), the ray would begin to bend more parallel to the roadway and then bend upwards towards the cooler air. As such, a person in a car sighting downward at the roadway will see an object located above the roadway.