Basically the front (side closes to the windshield) sensor lets the mirror know if it's day or night. The rear (the side facing you) sensor let's the mirror know if there is a car behid you.

If it is day time. The mirror will not dim because it does not need to. If it's night and there are no cars behind you, it will not dim because it does not need to. When someone pulls up behind you at night the mirror will dim to prevent it from blinding you.

If it's a good quality mirror it uses the front and rear sensor to adjust how much it dims depending on how bright it is outside and how bright the lights behind you are.