"The speed at which light propagates through transparent materials, such as glass or air, is less than c. The ratio between c and the speed v at which light travels in a material is called the refractive index n of the material (n = c / v). For example, for visible light the refractive index of glass is typically around 1.5, meaning that light in glass travels at c / 1.5 ≈ 200,000 km/s; the refractive index of air for visible light is about 1.0003, so the speed of light in air is about 90 km/s slower than c."
http://en.wikipedia.org/wiki/Speed_of_light#In_a_medium
"At the microscale, an electromagnetic wave's phase speed is slowed in a material because the electric field creates a disturbance in the charges of each atom (primarily the electrons) proportional to the electric susceptibility of the medium. (Similarly, the magnetic field creates a disturbance proportional to the magnetic susceptibility.) As the electromagnetic fields oscillate in the wave, the charges in the material will be "shaken" back and forth at the same frequency. The charges thus radiate their own electromagnetic wave that is at the same frequency, but usually with a phase delay, as the charges may move out of phase with the force driving them (see sinusoidally driven harmonic oscillator). The light wave traveling in the medium is the macroscopic superposition (sum) of all such contributions in the material: The original wave plus the waves radiated by all the moving charges. This wave is typically a wave with the same frequency but shorter wavelength than the original, leading to a slowing of the wave's phase speed. Most of the radiation from oscillating material charges will modify the incoming wave, changing its velocity. However, some net energy will be radiated in other directions or even at other frequencies (see scattering).
Depending on the relative phase of the original driving wave and the waves radiated by the charge motion, there are several possibilities:
• If the electrons emit a light wave which is 90° out of phase with the light wave shaking them, it will cause the total light wave to travel more slowly. This is the normal refraction of transparent materials like glass or water, and corresponds to a refractive index which is real and greater than 1.
• If the electrons emit a light wave which is 270° out of phase with the light wave shaking them, it will cause the total light wave to travel more quickly. This is called "anomalous refraction", and is observed close to absorption lines, with X-rays, and in some microwave systems. It corresponds to a refractive index less than 1. (Even though the phase velocity of light is greater than the speed of light in vacuum c, the signal velocity is not, as discussed above). If the response is sufficiently strong and out-of-phase, the result is negative refractive index discussed below.
• If the electrons emit a light wave which is 180° out of phase with the light wave shaking them, it will destructively interfere with the original light to reduce the total light intensity. This is light absorption in opaque materials and corresponds to an imaginary refractive index.
• If the electrons emit a light wave which is in phase with the light wave shaking them, it will amplify the light wave. This is rare, but occurs in lasers due to stimulated emission. It corresponds to an imaginary index of refraction, with the opposite sign as absorption.
For most materials at visible-light frequencies, the phase is somewhere between 90° and 180°, corresponding to a combination of both refraction and absorption."
http://en.wikipedia.org/wiki/Refractive_index
I guess the reason light "speeds up" when leaving the medium is just that the refractive index of air is less that the glass.