The number shown on a battery indicator is a calculation, not a measurement. Nothing inside a device can directly observe how much energy remains, and the consequences show up in familiar ways.
Charge cannot be measured directly
A cell stores energy chemically, and there is no sensor that reports the state of that chemistry from outside the cell.
What can be measured is voltage across the terminals, current flowing in or out, and temperature, and the percentage is inferred from those three.
The inference relies on a model of how the specific cell chemistry behaves, which is accurate in the middle of its range and much less so at the extremes.
Voltage under load is misleading
Drawing heavy current pulls the measured voltage down temporarily, which the model can read as a lower state of charge than actually exists.
This is why a phone can drop several points during a demanding task and recover part of it once the device returns to idle.
Cold has a similar effect, raising internal resistance so that a battery reports and behaves as though it holds substantially less than it does.
Counting current accumulates error
A more accurate method tracks the current flowing in and out over time, adding and subtracting to maintain a running total.
Small measurement errors accumulate in that total, so it must be re-anchored periodically against known reference points such as a full charge or a complete discharge.
Devices that are habitually kept between partial levels give the system fewer anchors, and the reported figure drifts further from reality over time.
Capacity itself changes with age
The total a cell can hold declines as it cycles, so the percentage refers to a shrinking quantity rather than to a fixed one.
Firmware estimates present capacity from observed behaviour and updates its reference, which is why an older device reports full charge yet runs for noticeably less time.
A sudden shutdown well above zero usually indicates that the estimate has fallen out of step with a cell whose capacity has dropped faster than the model expected.
The display is deliberately smoothed
Raw estimates fluctuate enough to be alarming, so the figure shown is filtered to move steadily and to avoid rising while a device is in use.
Some systems also compress or expand parts of the scale, which is why a particular range can seem to last unusually long or disappear quickly.
Treating the number as a rough guide rather than a reading is the accurate posture, and time-remaining estimates deserve even more caution.