The wavy lines that appear above a hot grill or an asphalt road in the middle of the summer are caused by a phenomenon called refraction. Refraction is the bending of light waves, and it occurs when light passes between substances with different refractive indices — in this case, cool air and hot air. Because hot air is less dense than cool air, light speeds up when it reaches a hot surface and then curves back upwards, causing the viewer to see an image of the sky and the surface to appear wavy in the heat. This phenomenon is responsible for desert mirages, as refraction and reflection look very similar to the human eye, and the refracted image of the sky from very hot sand can look like the reflection of the sky in a pool of water.
The reason that things look wavy in the heat, instead of appearing as a stable image of the sky, is that the air temperature is not stable. Hot air naturally rises, so as air comes off the hot surface, it rises for a bit before rapidly cooling and sinking to be heated again. This constant mixing of hot and cool air produces vibration, which translates into refracted images looking wavy. A road that looks wavy in the heat can be dangerous, as it may appear that water or oil has been spilled on the road, so it is important to drive cautiously when it is hot enough for so-called "highway mirages" to appear. The sand in a desert is also prone to mirage, which thirsty travelers can notoriously interpret as an oasis.
When things look wavy in the heat, the phenomenon is known as an inferior mirage, because the image seen is inferior to, or lower than, the real object, in this case the sky. A superior mirage is also possible, in which an image appears above the real object. For this type of mirage to occur, the hot air must be higher in the atmosphere than the cool air. An example of a superior mirage is the sunlight that is sometimes seen above the horizon when the sun itself is below the horizon.