What they used to do was simply measure the voltage of the battery pack, but this is unreliable as it varies long term with things like age and even short term with things like temperature (among many others). Most modern batteries owe their accuracy to what is called coulomb counting, if you...