...
The voltage at the battery terminal decreases/increases depending on the charge level. The voltage will be highest when the battery is fully charged and lowest when it is empty
If we know the relationship (curve) between the voltage at the terminal and its associated charge level, we can use that curve to figure out the SoC
Different types of battery have different types of curve (see lead-acid vs lithium-ion)
The flatter the curve, the harder/less accurate the measurements will be since a small change a voltage result in a completely different SoC measurement
In the image, a 0.5V difference results in a 40% difference in SoC
...