Desert travel stories take a dramatic turn for the worse when the hero rushes towards what appears to be an oasis. When she arrives, despair sets in as the inviting waters vanish, revealing more hot, dry sand. I've never seen a desert mirage, but on hot days, I've seen what appears to be shimmering pools of water on the road – only to drive closer to find the road is dry.
Mirages aren't a hallucination of dehydrated desert travelers, instead they arise from atmospheric optics. Remember how light bends when it passes from one medium to another? The refracted light is bent if the mediums are of different densities – mirages occur when light passes through many layers of air with different densities.
On a hot, sunny day, sunlight heats up the ground. This heat radiates, heating a layer of air right next to the ground. The next layer up also heats up – but not as much. The result is a gradient of heat with hottest air next to the ground and cooler air further away. Since the density of air depends on its temperature, hotter air is less dense than cooler air. So, in our sunny day example, the least dense air is closest to the ground (an unstable situation only persisting as long as the ground is being heated up). Which means the refractiveness of the air is less at the bottom than the top, so the light bends towards the cooler air.
Sunlight entering this temperature gradient at a shallow angle to the horizon is bent slightly differently by the different density layers. At first, it successively bends into shallower angles because each layer was less dense. At some point, the angle becomes so shallow light reflects, turning upwards, but still at a shallow angle. As this light travels back through the now progressively denser layers it's bent the opposite direction and the angle to the horizon would increase. Eventually, an observer's eye is reached – the poor hero in the desert or me driving my car.
So, a mirage is simply light refracted and reflected from the sky. Since sky reflections on the ground are typically indicative of water, our brains interpret what we see as a body of water.
I've described a static scenario, but in the real world hot, less-dense air rises, heating of the the ground is uneven and turbulence will form – all acting to make the mirage shimmer.