Your car's odometer seems like one of the simplest instruments in the vehicle. It says you've driven 42,000 miles, so you probably assume the car somehow knows exactly how far it has traveled. But there is no tiny measuring wheel rolling along the road underneath your car for that.
Instead, the odometer generally calculates distance from information about how the vehicle is moving. Depending on the vehicle, that information can come from wheel-speed sensors or a vehicle-speed sensor, with the car's electronics using programmed parameters to convert those signals into miles or kilometers.