How does refraction work?

When light travels through a given substance, the enegry of the light wave is constantly being absorbed and reemitted by molecules within the medium.

Therefore, when light travels through a vacuum (no molecules), it will travel at approximately 3X10^8 m/s, and when light travels through air, it will be slightly slower, due to the reduction in speed due to molecular absorbiton and resorbtion. (2.997X10^8 m/s). When light travels through dense matter, such as glass, it will slow more significantly.

This slowing or speeding up of light as it travels from one medium to the next is the primary cause of refraction. This is rather hard to conceptualize through text, but this is the best way that I can describe it. Picture a wave of light as a maching band in file. On concrete, they walk at a given speed. On mud, they walk at a lesser speed. Say the (light) band is approaching the concrete/mud barrier at an angle. When the front corner of the bank hits the mud, it will slow while the other corner of the front remains the same speed. Since one corner is traveling more slowly, the front of the band/light will "pivot" until the entire front of the wave is in the second medium, causing a change in the direction of the light. Kind of muddy, eh?

This process occurs from during transition between medias.

Therefore, for example, when you look at the surface of water, the light you see is actually bent (refracted) from a point where it physically isn't.