Polarized filters are most commonly made of a chemical film applied to a transparent plastic or glass surface. The chemical compound used will typically be composed of molecules that naturally align in parallel relation to one another. When applied uniformly to the lens, the molecules create a microscopic filter that absorbs any light matching their alignment.
Most of the glare that causes you to wear sunglasses comes from horizontal surfaces, such as water or a highway. When light strikes a surface, the reflected waves are polarized to match the angle of that surface. So, a highly reflective horizontal surface, such as a lake, will produce a lot of horizontally polarized light. Therefore, the polarized lenses in sunglasses are fixed at an angle that only allows vertically polarized light to enter. You can see this for yourself by putting on a pair of polarized sunglasses and looking at a horizontal reflective surface, like the hood of a car. Slowly tilt your head to the right or left. You will notice that the glare off the surface brightens as you adjust the angle of your view.
A lot of sunglasses advertised as polarizing actually are not. There's a simple test you can perform before you buy them to make sure. Find a reflective surface, and hold the glasses so that you are viewing the surface through one of the lenses. Now slowly rotate the glasses to a 90-degree angle, and see if the reflective glare diminishes or increases. If the sunglasses are polarized, you will see a significant diminishing of the glare.