I would like to know how do electronics (ie smartphones,mobilephones,laptops etc) know exactly what % of juice is left in the battery and how long that juice is going to last.
Thank you in advance
Such 'fuel gage' measurements are often pretty inaccurate on many consumer devices. There are two methods commonly used, especially for Li-Po powered devices. The 'low tech' method is to simply measure the battery terminal voltage while in use as LiPo cell has a fairly linear voltage discharge 'curve' of 4.2 at 100% down to 3.0 volts which is the common recommended lowest discharge voltage to use. The more 'higher tech' method is to measure current consumption continuously and integrate the value over time such that one can measure the actual mAH of capacity consumed sense the last full charge.