The shunt is programmed when you install it to know how big your batteries are and it keeps track of how many amps pass in and out of the battery.
Example:
You have 100ah of battery when it's full, the shunt shows 100% remaining, 100ah.
You plug in the inverter and power up the fridge for an hour. The inverter and fridge are drawing 10 amps so your shunt will show -10a, and after an hour it will have seen 10 amp hours go out, so it'll show 90% remaining, 90ah.
The sun comes up and starts pumping 20 amps into the system. The inverter is pushing 10a into the fridge and 10a into the battery, so the shunt shows 90% capacity, 90ah, and +10a. After an hour it will show 100% capacity, 100ah, and the charge controller will only draw in the 10a it needs to feed the fridge and not push anymore into the battery.
The sun goes down and you turn on the laptop to p0wn some n00bs online. The laptop and router and 7.1 speaker system need 50a worth of power from the battery to run, so the shunt will show 100%, 100ah, and -50a. After a half hour of spawn camping, you've used up 25a out of the battery so the shunt will show that you've got 75% capacity remaining, 75ah, and -50a of draw on the system.
The shunt just does the math on your batteries and keeps track of how much goes in, how much has gone out, and how much you have left.