Warning: Technical content below!
Basically, the laptop has built in current sensors and an estimation of how much charge is left in the battery (in milliamp hours). So if you are currently pulling 1A out of a 12000mAh battery, it would estimate you to have 12 hours remaining.
Of course, the laptop does not constantly pull 1A. It can range anywhere from 1A to something like 8A or even higher in extreme cases. So, dim screen, WiFi off, and typing something in Text Edit... your computer may pull something like 1.1A and last all day... but then you want to play that new fancy 3D game you got.
So you turn up your screen brightness all the way, switch to your dedicated card, and since it's no fun to play alone, you turn on the WiFi and connect up your Bluetooth headphones to your laptop. Fans start whirring, the thing is really cooking now! You're pulling 9A from that poor 12000mAh battery. You're remaining battery time now went from 11 hours down to 1.3 hours!