The angle and wavelength at which the light enters a substance and the density of that substance determine how much the light is refracted. The refraction of light by atmospheric particles can result in a number of beautiful optical effects like halos, which are produced when sunlight (or moonlight) is refracted by the pencil-shaped ice crystals of cirrostratus clouds.
When light passes from a more dense to a less dense substance, (for example passing from water into air), the light is refracted (or bent) away from the normal.
Another example of refraction is the dispersion of white light into its individual colors by a glass prism. As visible light exits the prism, it is refracted and separated into a magnificent display of colors.
Photograph by: Susan Schwartzenberg (c)1997, The Exploratorium
Each color from the original beam of light has its own particular wavelength (or color) and each wavelength is slowed differently by the glass. The amount of refraction increases as the wavelength of light decreases. Shorter wavelengths of light (violet and blue) are slowed more and consequently experience more bending than do the longer wavelengths (orange and red).