Lidar works by emitting rapid pulses of laser light and measuring the time it takes for each pulse to bounce back to the sensor. The time delay between emission and return is used to calculate the distance to the target object. This information creates detailed 3D maps of the environment, which are invaluable in various fields including geography, forestry, and urban planning.