The gears are electronically commanded by pressing the shifters which are integrated in the brake levers.
The electronic shifting system is animated by the new Shimano battery (SM-BTR2).
The battery is weighting only 56g and it is hidden inside the frame.
How long the battery can last depends of how much shifting is done, not how many kilometers are ridden.
Riding on a flat road in the country side with no traffic lights will provide much longer battery life than riding in the mountains or urban traffic.
One great feature of the Di2 gears is the fact that the battery goes into "sleep" mode when not in use in order to save more battery life.
It takes 4 hours to completely charge the battery, so it is better to make sure it is charged before going for a ride.