How does mechanical absolute encoder work?
Sort of like thumbwheel switches.

Customizing Digital Thumbwheel Switches

Incremental mechanical encoders are used in computer mice and digital control knobs but these usually only have 3 contacts that resolve A and B quadrature signals.