The phenomenon is based on the concept of Snell's Law whereby light impinging on a surface can reach a certain angle (or greater) where it completely reflects off that surface. This Critical Angle of incidence is a function of the refractive index of the two media.
The Critical angle occurs when sin(theta-t) goes to 90 degrees. Under these conditions Snell's law becomes:
To find out how much of the light (or energy) will go in all cases, either reflected or refracted, one needs to use equations described by Augustin-Jean Fresnel: the Fresnel Equations.
These equations describe light waves as Electric and Magnetic Vectors. What is important to understand is that the intensity of energy transmitted through an interface, when a light wave impinges on that interface is calculated using the Fresnel equations, and that this energy can be calculated knowing only: