In a perfect world I would shoot everything at 1/quintillionth of a second (Although we haven't achieved this shutter speed yet, we're getting closer. Watch here) and ISO 100 (or the native ISO of my camera). That way motion blur, camera shake, and noise would all be eliminated and dynamic range would be at it's peak. Then I would choose my aperture based on the depth of field I wanted to achieve and voila! Picture perfection. By now you should know that this isn't reality. Instead there's always sacrifices that must be made.
The three most important variables for any image are shutter speed, aperture, and ISO. These are the only factors that control how bright or dark your image is; the exposure. We've all seen pictures that were too dark or so bright that the subject was indistinguishable. This is because the exposure was incorrect for that situation. With a better understanding of how exposure works you can remedy that problem in the majority of situations.
All cameras measure light in stops. Likewise, aperture, shutter speed, and ISO are all measured in stops. Every time you increase an exposure by one stop you double the amount of light that reaches the sensor or in the case of ISO the sensor needs 1/2 the light to get the same exposure.
Before we go any further let me give you an example of why the exposure triangle is important. Let's look at three different scenarios. 1) Photographing basketball in a high school gym. 2) Photographing a baby indoors. 3) Photographing a flower just after sunset. To you and me these are three totally different situations. To a camera, they could all be the same. Why? Because the camera only "sees" light, and the lighting in these situations could be the same the way the camera sees it. If you let the camera do all of the work for you it would choose the same exposure for all three situations. Let's say it chooses a shutter speed of 1/50th, an aperture of f/2.8 (the maximum aperture of your lens), and an ISO of 400. This exposure is the correct brightness for all three scenarios. However, it doesn't mean it's what we want to use.
In scenario 1 the players would be moving quickly around the court. An exposure of 1/50th would make all of their movements come out blurry. We'd much rather shoot at 1/400th of a second. This is a decrease of 3 stops (1/50->1/100->1/200->1/400). So if we left the everything else the same the images would come out too dark. It would look like they played basketball in a cave. To counteract this we need to increase the aperture and or ISO by 3 stops. The aperture of f/2.8 is the maximum for our lens. That means we can't make it any better. So in order to get the proper exposure we must increase the ISO by three stops (400->800->1600->3200). Now the ISO is 3200. So the images will have more noise, but the players won't be blurry. Since we counteracted our change in shutter speed with a corresponding change in ISO the image is going to be the same brightness. That's the exposure triangle at work.
For scenario 2 the camera chose good settings. The shutter speed is quick enough to eliminate camera shake and a baby won't move much so motion blur isn't much of an issue. ISO 400 gives us good dynamic range and low noise. The aperture of f/2.8 gives us a usable depth of field.
Scenario 3 could use our help. Since our subject, the flower, is static we don't have to worry about motion blur (unless it's windy). If we use a tripod then we can eliminate camera shake. With those two variables eliminated we can use any shutter speed we want. The aperture of f/2.8 needs to be smaller so that our depth of field is bigger. We want the entire image in focus. So let's decrease the aperture two stops (2.8->4->5.6). Ideally we'd like to use an ISO of 100. That decreases our exposure another 2 stops (400->200->100). If we took a picture at ISO 100, f/5.6, and 1/50th of a second we would get an image that's nearly black. To counter our changes be need to lengthen the shutter speed 4 stops (1/50->1/25->1/12->1/6->1/3). Now our shutter speed is 1/3 of a second, but that doesn't matter because we've eliminated camera shake and motion blur. Now we have an image that is totally in focus, has maximum dynamic range and minimal noise.