how does a rangefinder work?

how does a rangefinder work?