The index of refraction is basically due to the electrons of the medium. The electric field of the wave excites oscillations of the electrons, which in turn emit electromagnetic waves that overlap with the incident wave. The net effect is (a) a change in the velocity and (b) absorption. Both together can be described by a complex index of refraction