Not schoolwork related, just one of those "I wonder how that works?" situations. So I didn't have any specific batteries in mind, just wondering about some ways that it's done in general.
I did some googling, but the results I got were stuff like timing how long the battery takes to drain to figure out the full charge, which obviously doesn't happen for the indicators I'm thinking of. I don't quite know the right magic words to search for to pull out the answer.
My first thought was that there might be some V-Ah (Volt -- Ampere-hours) characteristic curve for to battery, ie the voltage changes in a slight, predictable way depending on the remaining charge in the battery. But then I remembered that the voltage would also vary with the load so that's no good.
I know that when the battery gets drained too far the voltage can drop pretty significantly, but that's not precise enough for something to measure, for example, that the battery is 75% charged.