So far no-one has mentioned this neat rule of thumb: when light passes into a denser medium its speed decreases and it "bends" toward the normal. Conversely, when light gains speed it bends away from the normal.

When Snell's Law doesn't work out, total internal reflection happens. For example, say we have a light ray going from a dense medium like water (index of refraction of approximately 1.3) into air (index of refraction of approximately 1.0) at an angle of 55 degrees:

n1 sin θ1 = n2 sin θ2
1.3 sin 55o = 1.0 sin θ2
1.065 = sin θ2
Clearly, this is impossible because sin doesn't produce values greater than 1.0. When a situation like this arises, light reflects rather than refracting.