We learn in secondary school how refractive index is a ratio of the speed of light in vacuum to the speed in the medium; that light travels slower in a material medium than in vacuum. But we always wonder what make light know to which angle it must refract when it’s time to turn, and we are curious about how light know its way when it reaches an interface. There is the principle of least time by Fermat to offer an explanation. But this still leaves us wondering : by what mechanism in the material through which light travels is the path of light determined ?
Here we will look at some equations of Electromagnetism that offer a way to understand the mechanism that gives rise to the refractive index of the material.
Our microscopic model of an atom shall be that of electrons joined to the nucleus by spring-like attachments. This of course is just a picture that is only partially true, but useful for visualising and formulating our explanation.
The equation of motion of an oscillator is :

If the electric field vector is sinusoidal, then so are the displacement of the oscillator and the induced dipole moment :

In material medium, the Polarisation vector, the polarisation charge density and the the current density are given as :

Now we bring out Maxwell’s equations applied to material medium :

Taking the curl on the curl of E, and making all necessary substitutions using the rest of Maxwell’s equations, plus known identities of nabla operations, we arrive at :

We assume that the medium is isotropic, that the wave propagates
in the direction of z, and that the E-field and the P vector both only have components in the x-direction only.

One more assumption, which needs some correction later, is that P is directly proportional to E, and we finally arrive at a formula for the refractive index :

Three corrections to the above formulation will give a more accurate final formula.
Firstly, the polarisation is proportional to the local field, not to the incident field, so we should have :

A second improvement is to use the quantum mechanics version of polarisability, as remarked above.
Finally if the medium is made up of a mixture of different types of atoms each with its own polarisability, then the contribution due to each type of atoms is to be added to obtain the final total polarisability.