Mirages occur when there is a rapid shift in air density in the atmosphere -- when the air at one level is a lot hotter than the air at an adjoining level (check out this page to find out why hot air is less dense than cold air).