Light rays usually travel in straight lines, but when they pass from one material to another they can be forced to bend (change direction and continue on a new straight path). The bending is called refraction. It happens because light travels at different speeds in different materials. If light rays travel through air and enter a more dense material, such as water, they slow down and bend into the more dense material. Light rays moving into a less dense material, such as from water to air, speed up and bend outwards.
If you stand a straw in a glass of water, the top and the bottom of the straw no longer seem to fit together. This trick of the light is caused by refraction. Light bends outwards when it travels from water to air, so the eye sees the bottom of the straw (in the water) as deeper than the top of the straw (in the air).
On hot days, the surface of the Earth is warmer than the sky above it. This means that air close to the ground is generally much warmer than the air higher up. Hot air rising from the ground can bend and distort the light rays passing through it. This gives a very hazy appearance to objects, such as this giraffe, as they move on the horizon.
People who travel through hot deserts often think they can see water or trees on the ground ahead of them, when really there is nothing there. This trick of the light is called a mirage. Layers of warm and cold air bend or refract light rays coming from distant objects – perhaps real trees over the horizon. Our eyes are fooled into thinking the light rays come from objects on the ground instead of from the sky.