There are some nice ray diagrams explaining total internal reflection on BBC Bitesize.
Cyberphysics has some examples of how optical fibers are used and the youtube video below shows how they can be used by doctors to see inside a patient’s body.
Usually material 1 is air, and so n_1 = 1. This simplifies Snell’s law to
\sin \theta_i = n \sin \theta_r
where n is the absolute refractive index of material 2. Since the refractive index is equal to the ratio of the ray’s speed v in materials 1 & 2 and also equal to the ratio of the wave’s wavelength λ in materials 1 & 2, we can show that