This is called a mirage. The one you are referring to is called an inferior mirage, meaning lower in the atmosphere. The mirage is caused by cold and warm air bending the light ray as it travels to your eyes. If the air closer to the ground is warmer than the air above it, the light ray bends in an upward path or concave direction. When the light reaches your eyes your brain thinks that it is from a straight line of path. However, the light ray has been bent and projects the image above being the sky on the ground. You brain may trick you into thinking it is water because it is more realistic and common to see water than sky on the road/pavement.
This phenomenon is called mirage, which is caused due to refraction of the sunlight in the different layers of the atmosphere.