How Your Camera Meters Light
Your camera reads the light in your frame with several different methods. I recommend using the Evaluative method (Canon) or Matrix Metering (Nikon). All cameras will have a similar method - look for the symbol that looks like an eye in a rectangle.
Evaluative metering reads the entire scene to evaluate the best exposure overall but puts most importance where your light meter is pointed. The light meter is tied to the focus point in either live view or looking through the camera.
The 18% Gray Reality
Your camera is calibrated to assume the average brightness of your composition equals 128 (middle gray). In a scene that's half black and half white, averaging to 128 works perfectly. But in a predominantly bright or dark scene, the camera will get it wrong - that's where you come in.