Electronic component that detects angular rotation like a potentiometer, but endless and digital
The name for the thing you're looking for is rotary encoder. In particular, the incremental rotary encoder.

If connected correctly, you will get pulses such as these:



Depending on the direction you're turning, those two pins will flip its state in a different order, so you can find out the direction.

Most of the ones that you want to pay for will have up to 24 "increments" in one revolution. This is not that great, but you can easily get 48 steps from that, if you think a bit about how the signals arrive. You can even get 96 steps per revolution iff the pulses are square and have a 90 degree offset such as in the illustration above. Some encoders don't, and then your 96 steps will not be evenly spaced.