When a photon hits a pixel it produces an electrical signal. You can think of the ISO as the amount that signal is amplified. So, if you want to keep aperture and shutter speed at certain levels, you can adjust the ISO to produce a usable image. The tradeoff is that when you amplify a signal a great deal, it gets noisy.
Changing the ISO at time of exposure actually increase the amplification at the sensor level. Changing the exposure in post processing just shifts bits around (the advantage of RAW is that, depending on the camera, it captures between 12-16 bits vs. 8bits for jpeg images and it's not compressed so shifting the bits around doesn't have quite as noticeable an effect).
To understand, you really need to get a grasp on the basics of exposure. This may be helpful: http://www.ajkesslerblog.com/understanding-exposure/
When a photon hits a pixel it produces an electrical signal. You can think of the ISO as the amount that signal is amplified. So, if you want to keep aperture and shutter speed at certain levels, you can adjust the ISO to produce a usable image. The tradeoff is that when you amplify a signal a great deal, it gets noisy.