Total internal reflection occurs when light is traveling through a medium with a higher refractive index and encounters a boundary with a medium with a lower refractive index. The angle of incidence is greater than the critical angle and the light is reflected back into the original medium.