This is the most fascinating part of all this, how the camera determines proper exposure!
That is the answer. Yea, pretty fascinating isn't it! But wait, it gets better.
Let's try a little experiment. Get some black paper and some white paper.
Hang up the paper (taping the paper to the wall, make sure you hang it in landscape mode) and get your camera. Fill the screen with the black paper - the whole viewfinder needs to only be the black paper - and if your camera is on automatic mode, take a picture. Now, look at the picture you just took.
Scratching your head yet? Your black paper should look, well, like 18% gray?
Let's try this again, only using the white paper.
Take your shot, and view the image on the back of the screen. Yea, it too is about 18% gray.
Is there something wrong with your camera? The black paper is apparently - to us anyway - black, and the white paper is apparently white. But both exposed as 18% gray. What happened?
When you fill the screen with something black, the camera considers 18% gray to be the proper exposure, so will expose the black as gray. And the same thing with the white paper, it too will consider the proper exposure to be 18% gray and will expose the white paper as 18% gray!
In these kinds of situations, the light meter actually uses the histogram and uses an internal database of similar exposures and some fancy algorithms to get at what it believes the proper exposure should be. The end result is that the mid tones are weighted as the peak of the histogram, hence you end up with the camera's resultant exposure as 18%. In another word, in a scene that has high luminance, the camera wants to find the mid tones and set the proper exposure as the mid tones. But it really doesn't find any mid tones, so it assumes that the bright areas are really mid tones, thus underexposing the image so that the bright areas actually become the mid tones per the histogram! Usually, for snowy scenes, the image will be underexposed by 1 to 2 stops!
Camera Light Meter
The light meter's central purpose is to expose the photograph so that middle gray is exposed as 18% gray. The world is in color, but to the light meter, it only sees the scene in tones (for simplicity, just think of the scene as a series of gray tones), and it considers middle gray to be 18% gray and exposes the image with that metric.
Now, both you and I know that the world isn't black or white (just a little tongue in cheek!), but rather is a whole range of tones. Now, this is the second time I have used the word tone without defining it, so I will do so here. Tone, at least in photography and in color theory is simply a scale of the darkest area to the lightest area in a scene. Don't think of color, think of brightness, or the lack thereof, as tone. This is what the light meter is measuring, and the middle of this scale as seen above is 18% gray.
The experiment with the black and white papers is really just us playing a trick on the light meter, but it does demonstrate what the light meter is all about. By just have one tone, either black or white, dark or light, the light meter has to assume that the tone should be 18% gray.
In real life, scenes are not either total darkness or total brightness, but rather the scene covers a range of luminosity values. But when the meter exposes the scene, it tries to expose so that the middle gray tone is 18% gray.
So, if we look at scenes with great contrast, the difference between the darkest areas and the brightest areas, such as sunsets or sunrise, we will find that the camera will be fooled by the bright sun and will tend to underexpose to compensate for the brightness of the sun. The same thing happens when we are taking photographs of winter scenes with a lot of white snow. The camera will tend to underexpose the image to compensate for the brightness of the scene - again, trying to get the exposure so that middle gray is exposed as 18% gray. So if we properly expose a snowy scene, the snow will be seen as gray and not white. The camera attempts to expose the luminance of the scene as 18% gray!
The same goes for a dark scene, but only in the opposite direction. I have two black cats, and when I take photos of them, the camera wants to overexpose the scene because it wants to see the black cats as 18% gray! Sheesh, my cats get really insulted when they see themselves as gray instead of the glorious and shiny black cats that they are!
So the camera will tend to overexpose a dark scene, and will underexpose a bright scene, all in the attempt to reach exposure nirvana which is 18% gray! And as photographers, we struggle with assessing a scene and determining how much to over or underexpose a scene to account for the built-in light meter's attempt to make everything 18% gray! But don't worry, you will get the hang of it, through trial and error, but then we all learn from trial and error!
Other Web Sources to Explore
This is not an attempt to get technical, so some specifics have been glossed over for the sake of explaining the concepts. This is a very complicated subject and one can quickly find themselves deep in the weeds on this subject. This is NOT a definitive account of how exposure works, but just a way to explain the concept so that the average photographer can use the concepts in the application of their photography.
You can easily google "exposure" to further explore the concept of exposure and how the camera exposes the scene. It can get very complicated quickly as you will see. But if you persevere, you will learn about exposure and much, much more! Just a word of warning, many of these discuss metering modes. I haven't discussed metering modes yet, but will in a few weeks. I really have been focusing on just the basics, so bear with the websites below, and if the metering modes get confusing, just skim over those sections and wait until I reach that point to discuss them (I am planning a separate week for each metering mode, by the way).