That's very interesting Alberth, thank you! I thought of a keyboard and thought maybe it was different milliamperes for the keys now I'm thinking it's the voltage. Does a keyboard use prime numbered voltages?
It started with analog computers see
https://en.wikipedia.org/wiki/Analog_computer
where variable values were electronic voltages, and a program was an electric circuit. Infinite precision for free, but not very accurate due to inaccuracies in the electronic components (due to aging and varying temperatures).
Digital computers are completely digital, ie 2 voltages everywhere. For a keyboard, the keys are detected with a wire matrix, as Hodgman linked to, transfer to the computer is serial, ie 1s and 0s over time, through a single wire (and a second ground wire, as the common reference point). To get an idea of how that works, an ancient serial RS-232 connection is probably one of the simplest protocols, see https://en.wikipedia.org/wiki/Asynchronous_serial . Usual there are more wires, eg for control flow.
Serial connections work very well, eg USB and SATA (to/from disks) are serial connections too.
Everything is voltage based in computers, as that gives much better switching times, but there exist current based protocols too, eg RS-422, an industrial serial protocol like RS-232, but it uses currents to represent 1s and 0s. Big electric motors switching on and off gives huge voltage spikes in nearby wires due to induction, so running a RS-232 at a factory floor doesn't quite work, the voltage spikes mess up the 1s and 0s voltages. Current is much more stable in such an environment.