The shutter is probably one of the simplest aspects of the camera to understand. The earliest cameras consisted of little more than a big box with a small hole in the front of it and plate at the back covered with light sensitive material. The photographer would insert the plate into the back and remove a protective cover over the plate that prevented inadvertant exposure to light. When he was ready to make a picture, he removed a cover over the hole in the front, allowing light into the camera to strike the plate. The light sensitive material on the plate recorded areas of varying intensities of light to render a black and white image. In those days, the light sensitive material used on the plates wasn't really terribly sensitive so the exposure time was often measured in hours. That meant that you had to be doing a still life image or your subject had to remain perfectly still for long periods of time.
Over the last 200 years, we've gotten a little more sophisticated with the shutter. On film cameras, the shutter is usually a two-curtain mechanical device. One curtain overlaps the other. When the shutter button is pressed, the first curtain begins to slide out of the way of the film, going from one side to the other or top to bottom. Then the second curtain begins to follow the first curtain, covering the film up again. The time between the two the curtains determines the exposure time.
So why have two curtains? Why not simply have one curtain that opens, exposes the film, then closes again? Well, the main reason is that todays medium used for exposing images is MUCH more light sensitive than those first cameras. Instead of exposures being measured in hours, they are typically measured in fractions of a second. Today's cameras can capture images as fast as 1/8000th of a second. The fact of the matter is that the physical mechanism that moves the curtain can't move that fast. What happens with a really fast shutter speed is that the second curtain begins closing at nearly the same instant that the first curtain begins opening, exposing a very tiny sliver of the film as the two curtains chase each other across the film plane. So the image doesn't get recorded all at one time but rather one column of light at a time.
Today's digital imaging sensors render the physical shutter nearly obsolete. With most point-and-shoot digital cameras, the exposure time is actually determined by the length of time that the sensor pixels (or picture elements) are actually turned "on", capturing light. Since it is an electronic on/off sequence, it can be done pretty much instantly for all the pixels on the sensor at one time. In most digital cameras today, there actually isn't a physical shutter. However, digital SLRs still use the mechanical shutter or a combination of mechanical and digital shutter to control exposure.
So, how does shutter speed affect your image? The bottom line is that the longer the shutter speed is, the more light you are gathering, the brighter the image. A "proper" exposure is determined by other factors such as the amount of light available and the size of the opening through which the light reaches the sensor (also known as the aperture, which we'll cover next) and the sensitivity of the sensor (also known as ISO, which we'll cover later as well), as well as shutter speed. But the shutter is literally the last light control in the path the light takes on its way to the sensor.
There are some side effects to shutter speed that can affect your image. Shooting with a very fast shutter speed has the affect of stopping the action in a scene. That might be what you want if you are shooting a moving subject. Maybe your trying to capture a baseball player swinging the bat and you want to freeze the action. Or maybe you are shooting a hummingbird at a feeder and want to freeze the fast wing beat.
On the other side of the coin is a slow shutter speed. Shooting with a slow shutter speed will cause anything moving to be blurred. That might be good if you are trying to get the silky look of a water fall, but it might not be so good for that 3rd grade school play your trying to photograph.