How do I update Di2 firmware?

You will need the Shimano e-tube project software to upgrade firmware. Keep an eye on their firmware update page and whenever they release new firmware for your components simply connect your bike to a windows computer and run the e-tube project to start updating.

If you're using the battery charger to connect to your bike, use E-Tube Project 3.4.5 (or 4.0.4). Those can be found on the E-Tube Project Archive page.