On a hot day, the road ahead can look as if it is covered with water.
You drive closer.
The puddle moves farther away.
There was never any water.
You are seeing a mirage.
Hot pavement heats the air above it
Sunlight warms the road surface.
The road then heats the thin layer of air directly above it.
That air may become much hotter than air only a short distance higher.
Temperature changes air density.
Light bends through the layers
Light changes direction when it travels through regions where its speed changes.
Air layers with different temperatures and densities can therefore bend the path of light.
This is refraction, the same general phenomenon behind why a straw looks bent in water.
Sky light can bend upward toward your eyes
Some light coming from the sky travels downward toward the hot air near the road.
As it passes through the changing layers, its path curves.
It can reach your eyes from below your normal line of sight.
Your brain assumes light traveled straight
Vision usually works extremely well under the assumption that incoming light traveled in a straight line.
So the brain traces the light backward.
It appears to be coming from the surface of the road.
Because the light originally came from the sky, the patch may look blue or bright.
That resembles water reflecting the sky.
Why does the puddle move when you approach it?
The mirage depends on the angle between your eyes, the road, the hot-air layers, and the incoming light.
As your position changes, the geometry changes.
The apparent patch appears farther ahead.
You can chase it for miles without getting your tires wet.
Are all mirages the same?
No.
Different temperature arrangements can produce several types of mirage.
Some make distant objects appear displaced, stretched, inverted, or even floating.
The hot-road version is simply the one most drivers know.
So there is no puddle ahead.
The road heated the air enough to bend sky light into a very convincing impersonation.
And that’s the short explanation.
Related explanations: Why does a straw look bent in water?, Why do shadows change size?, and Why is the sky blue?