When a ray of light travels from a denser medium (like glass or water) to a rarer medium (like air), its speed increases. According to Snell's Law and the principle of least time, the ray bends away from the normal drawn at the point of incidence.