Refraction, the critical angle and total internal reflection
How Snell's law bends light between media, why a critical angle appears going to a rarer medium, and how total internal reflection guides fiber optics.
Why light bends at a boundary
Light travels slower inside a dense material than in a vacuum, and the refractive index is the ratio of those two speeds. When a ray crosses from one medium into another, the part of the wavefront that enters the new medium first changes speed before the rest, which pivots the ray. That pivot is refraction, and Snell's law puts a number on it: n1 sin(theta1) equals n2 sin(theta2). Entering a denser medium bends the ray toward the normal, while entering a rarer medium bends it away.
Working a forward calculation
Suppose light in air, index 1.0, strikes a glass block of index 1.5 at 30 degrees from the normal. Snell's law gives sin(theta2) equal to (1.0 x sin 30) divided by 1.5, which is 0.5 divided by 1.5, or 0.3333. Taking the inverse sine returns 19.4712 degrees, so the ray inside the glass runs closer to the normal than the incoming beam. Because the second medium is denser, there is no critical angle in this direction and the light always gets through.
When the critical angle appears
Reverse the journey and send light from water, index 1.33, back out into air, index 1.0. Now the ray bends away from the normal, and at a steep enough angle it would need to bend past 90 degrees, which cannot happen. The threshold is the critical angle, asin(n2 / n1), which for water to air is asin(1.0 / 1.33), about 48.7535 degrees. Below that angle light still escapes; at or beyond it, escape becomes impossible.
Total internal reflection in the real world
Once the incidence angle passes the critical angle, every bit of light reflects back into the denser medium instead of refracting out, an effect called total internal reflection. Optical fibers rely on it to trap light inside a glass core and pipe signals for kilometers with little loss. The same physics makes a diamond sparkle, since its high index of about 2.42 gives a small critical angle that traps and recycles light through many internal bounces before it leaves.