system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does a computer tell us how much battery percentage is left?
gpt
They use a method called "Coulomb counting". 
Imagine you bought a wallet to store your money. You know it's empty. Now you put $100. You know, the wallet holds $100. Then you stopped by a gas station and spent $20. Now, even without looking, you know that there are currently $80 in your wallet. 
Coulomb counting works similarly with batteries - the charge controller monitors how much energy was put into battery and how much was used (and reports this to the computer).

This method is subject to some inaccuracy due to losses and gradual deterioration of battery's properties, but is good enough and is much better than measuring voltage (laptop batteries have a very flat discharge curve). Some systems employ "learning" algorithms to adjust the value based on how the battery was charging/discharging previously.