A mirage is an optical illusion caused by the refraction of light rays in layers of air at different temperatures, leading to the appearance of water or other distant objects. This phenomenon occurs most commonly on hot days when the ground heats the air above it, creating a gradient of air densities. As light travels through these varying densities, it bends, causing images to appear displaced from their true location.