The total exposure you get is governed by four factors:
- The brightness of the scene.
- How sensitive the sensor is.
- How long the scene light is projected onto the sensor.
- How concentrated the light from the scene is on the sensor.
The last three are tradeoffs we get to control in the camera, and together are often termed the "exposure" that was used to take a picture. In some cases we can control the scene brightness, like with lights in a studio or with a flash. Cameras do control flashes sometimes, but for the sake of this answer we'll say the scene brightness is given, and we want to adjust the other 3 items to get the desired exposure.
The ISO setting controls how sensitive the sensor is. Back when sensors were film, you decided this by what you loaded into the camera. Films had various tradeoffs between sensitivity and grain. The more sensitive films were more grainy.
With today's digital sensors, you can chose the sensitivity frame by frame. However, just like with film, there is a tradeoff. Actually most sensors have a single native sensitivity, then the output of the sensor is amplified (or in some cases actually attenuated) before being digitized. The problem with amplifying the sensor signal is that you amplify the inherent noise along with the image signal. Some sensors are better (less noisy) than others, so allow for more amplification before the noise gets large enough compared to the image signal to be objectionable.
The shutter speed is pretty much what it sounds like, and is how long the image is projected onto the sensor. Longer times let the sensor accumulate more data relative to its noise and are therefore better from that point of view. However, of course there is a tradeoff. Anything that moves in the scene, or the whole scene if you move the camera, will be blurred more the longer the shutter is open.
For example, if you're taking a picture at a sporting event and someone is running at 3 m/s sideways to your view, he would look like a 3 meter wide blur at 1 second shutter speed. At 1/100 second the blur would be 3 centimeters, and at 1/1000 second only 3 mm. There is no single answer as to what is better, which is one reason cameras give you these choices. You may want someone running being blurred to show speed. On the other hand you might want to show the instant expression on the face with drops of sweat hanging frozen in mid air.
In any case, the 1/1000 exposure gives the sensor 10 times less light to work with, so its signal will be 10 times closer to its noise level.
This is somewhat of a aside, but digital sensors also accumulate some noise over time. This is why digital cameras usually limit exposure times to 30 seconds or so. Unlike film, you can't just leave a digital sensor sensing for long periods of time with dim light.
F-stop or Aperture
The f-stop or aperture controls how much light the lens lets thru. The f-stop number is actually the ratio of the effective diameter (for the purpose of letting light thru) of the lens divided by its focal length. This is done because that normalizes the light-letting-thru measure of lenses independent of focal length. For example, a 50 mm lens set to f/8 will project the scene with the same brightness as a 200 mm lens set to f/8. The 200 mm lens will make each scene element 4 times larger across, so it will be spread out over 16 times more area. That means it needs to collect 16 times more light from the scene to get the same brightness. However, all that is taken into account with this normalized aperture measure we call the f-stop.
Of course again there is a tradeoff. A wider open lens (lower f-stop number) gives the sensor more light, which results in a better signal to noise ratio. However, the depth of field (the distance over which scene objects will be in focus) will be lower. Imperfections in the lens will also be more prominent.
At really small apertures (larger f-stop numbers), diffraction becomes a issue. The light rays that just glance past the edges of the aperture diaphram get bent a little instead of continuing on straight. This only happens when they pass close to something that would block them, so this only matters to the ring of light rays that pass just inside the aperture. As the aperture is set smaller, a larger fraction of lights rays are close to the edge, and these bent rays make up more of the light hitting the sensor. The result is that bright objects in the scene cause other areas of the projected image to get lighter too. The overall affect is to reduce contrast and give the appearance of less sharpness.
Usually f/5.6 or so is the sweet spot, but that depends on the specific lens. Most of the time you don't worry about this too much, and good quality lenses will still take good pictures at f/2, and diffraction is hard to notice at f/22. I've taken macro pictures at f/64, and the loss of sharpness due to diffraction was quite evident.
Most of the time, however, we trade off f-stop between letting more light thru and too small a depth of field.
Putting It All Together
Overall exposure is therefore controlled by the ISO setting, shutter speed, and f-stop. The various results you trade off against each other are mostly giving the sensor enough light so that the image signal is large compared to the noise, motion (or camera shake) blur, and depth of field.
As a general guide, a normal scene in full sunlight is well exposed at f/16 and the shutter speed set to 1 divided by the ISO value. For example, that can be f/16, 1/100 second, and ISO 100. Or it could be f/16, 1/250 second, ISO 250.
In photography, a factor of two in exposure is a clearly noticable step, but not a particularly large one. We usually think of adjusting exposure in numbers of 2x steps. You can think of a factor of 2 as being a "standard increment" in photography.
ISO adjusts linearly. ISO 200 is twice the exposure of ISO 100.
Shutter time is also linear. However, since we usually write the shutter speed numbers as reciprocals (1/100 second, 1/250 second, etc), the bottom number goes down to increase exposure. 1/50 second is twice the exposure of 1/100 second.
The f-numbers math is more complicated. The exposure goes with the logarithm of the reciprocal of the f-number. Since this gets complicated to do mentally, a bunch of f-numbers have been pre-computed that cause half the exposure from the previous. Each of these f-numbers must be the square root of 2 higher to make half the exposure. Starting at f/1 (almost never happens), we therefore get the progression f/1, f/1.4, f/2, f/2.8, f/4, f/5.6, f/8, f/11, f/16, f/22. These values are so commonly used that early cameras often had detents on the aperture ring to allow positively setting to one of these values, and to allow adjusting up or down by feel while looking thru the viewfinder. These detents were also called "stops", which is where the term "f-stop" came from.
Since the common f-stops each represent a factor of 2 brightness from the next, the term "f-stop" has come to be used as a factor of two in exposure, even if the aperture itself isn't changed. For example, it is common in photography to say that ISO 400 is "2 f-stops" more than ISO 100, or that 1/500 shutter speed is 1 f-stop down from 1/250 shutter speed.
We usually think of exposure in terms "f-stops" up or down. For example let's say you took a picture at ISO 200, f/5.6, and 1/250 second. This came out too dark, and you felt that it needed 2 f-stops more exposure (factor of 4 more light). You might try any of the following to get this additional 2 f-stops of exposure:
ISO 200, f/2.8, 1/250 s
ISO 400, f/4, 1/250 s
ISO 400, f/5.6, 1/125 s
ISO 200, f/4, 1/125 s
However, while the exposure of each of these four examples above is equivalent, the depth of field, motion blur, and sensor signal to noise ratio won't be. Most modern sensors have little noise relative to full exposure at ISO 400, so the last tradeoff in these examples wouldn't likely be a issue in most cases.
Again, it's all about tradeoffs. There are no right or wrong answers, only what works with your camera, with your scene, and with what you are trying to show.