system
Given the following post, respond as if you're commenting on Reddit:
human
How do battery life indicators work?

How can an electronic device measure the remaining amount of life in its batteries? Is there some fundamental difference in the process of the chemical reaction between a dead battery and a full one, or is the measurement based on something like the strength of the current?
gpt
There are two basic ways.

First, batteries do not have a constant voltage over their entire charge cycle. The plot of voltage vs capacity for a discharging battery is called "discharge curve", and you can use that curve together with a voltage measurement to estimate remaining battery capacity.

The main advantage of this is that it is a single-point measurement (that is, you do not need to know how long the battery has been discharging to use this method of estimation). However, the discharge curve varies somewhat with the load on the battery, so this method has some inaccuracies.

Second, you can literally count the amount of charge that is delivered by a battery, using a device known as "Coulomb counter". This device is only useful if you know what state your battery started in (for example, 100% charge), and you know the total battery capacity. Since total battery capacity varies over the lifetime of the battery, this also has inaccuracies; also, this method requires continuous monitoring to tally up all the charge that flows in and out of the battery.

In practice, these two methods are combined.