If you stand in front of a normal window in your house at night (inside the house, with the indoor lights ON), you will be able to see your reflection in the glass quite clearly. A car's mirror takes advantage of the same effect.

The mirror is not ground flat -- the front glass surface is at an angle to the back (mirrored) surface. So if you looked at this mirror out of its casing, it would be wedge-shaped with the thicker edge at the top. When you "flip" the mirror, the back mirrored surface actually points toward the dark ceiling, so you don't see that image. What you see instead is the image reflecting off the front of the glass, and this is much dimmer that the pure reflected image so it does not hurt your eyes.

To prove that this is what is happening, take a flashlight with you one night and play with your mirror (while the car is parked in your garage, preferably). Flip the mirror and shine the light at the ceiling (or sometimes the floor) and the fully reflected image will overwhelm the front-surface reflection so you can see the ceiling.

Here are some interesting links: