Alongside ISO and your aperture size, the shutter speed is the third key ingredient to taking that magical photo. Whereas ISO is the sensitivity of the film, and the aperture the volume of light that can come through the lens onto the sensor (or film) the shutter speed determines the amount of light that is to hit that frame. A shutter speed setting can be anywhere from 1 trillionth of a second to minutes, hours or even days depending on what it is that you are photographing.
High speed objects like sports personalities are photographed at 1,000th of a second or more, portrait photos at 1/50th of a second or more and deep space objects or dark night shots can often run into minutes and hours of exposure. In fact some Deep space shots can run into days (The Hubble telescope recently did an explosure of 23 days to get photographs of galaxies some 3.5 billion light years away).
If you have ever wondered how a camera shutter actually works you can see it working here in slow motion. But it is quite simple in that whatever time is set for the shutter to be open for, once the trigger is pressed a mirror slips up and exposes the film (or CCD) to the lens for the preset amount of time. The faster the shutter speed the less light that gets in but the more the image is frozen and the less blurring that occurs. The exception to this is when the camera gets up into high shutter speeds and a rolling shutter is then employed, and when one gets up into even higher speeds, say above 1/2000th of a second electronic shutters are used which means the CCD is exposed completely electronically.
In this short video Mike Browne explores shutter speeds in detail