When should I replace my Di2 battery?
The easy answer is: when it no longer holds charge or depletes very quickly.
Shimano say their battery is rated for 300 full charge cycles. This means that if you charge the battery every other week it should be good for about 11 years.
Of course some batteries fail before that and some fail after that - but this is the Shimano guideline: 300 full charge cycles.