Well actually you can’t ‘see’ through glass (sorry to be knit picky). What happens is the particles of light (these are call ‘photons’) are able to travel through certain materials and not others. In the case of glass, photons are able to travel through from the other side of the glass unimpeded to your eyes.
But what the hell is going on here?
If you could image a 3 year old boy being told clean his room by his parents, but his parents have said you must put all the toys back exactly where you found them. Like most boys that age, the toys that the he would put away would more likely be those that are the easiest. He would put the rocket ship back in the toy box on the floor and his Iron man action figure on his desk, because he can easily reach these areas. However, the toy that he wouldn’t want to put back (his truck) is located at the very top of the shelf, which he can’t reach, so the boy would simply leave the truck on the floor. This is exactly how photons and electrons behave.
The atoms that make up glass have their electrons arranged in a certain way. Where they are stacked up dictates if visible light can travel through them. The photons job is to excite (pick up) an electron (the Iron man toy) from its ground states (the floor of the boys bedroom) and lift it up to a higher energy state (his desk). When this happens the photon is absorbed by the atom meaning that the photon will not travel through the substance.
For glass however, this requires a lot more energy because of the materials in the glass. Think back to the boy’s truck, it was too far up for him to put it back on the shelf so he couldn’t be bothered putting it all the way up there, this is exactly what happens to light passing through glass. The electrons require too much energy to go from the ground state to their excited state, and when the electrons aren’t excited it means that they will not absorb the photons of visible light. This means that the light can pass through unimpeded.
It must be mentioned that different colours of light have different amounts of energy so special glass can be produced (the glass used in your sunglasses) which will allow only specific energies of light to pass through.
So next time you peer through the window just remember that quantum mechanics is at work yet again!