Why does Earth have abundant oxygen in the atmosphere?
This is only a partial answer as it doesn't explain why the excess of O2 stayed but one thing you have to appreciate is the fact that aerobic respiration appeared almost half a billion years after photosynthesis, so we can't really say that photosynthesis and respiration have always balanced each other.  

Cyanobacteria (and with them photosynthesis) are believed to have appeared somewhen between 3 and 2.5Ga (e. g. Altermann &amp; Kazmierczak 2003, Brocks et al. 2003) while Mitochondria (and with them aerobic respiration) are thought to have evolved somewhen between 2 and 1.5Ga (see e. g. Hedges et al. 2004).

There was therefore at least half a billion year during which cyanobacteria were producing O2 with no one able to breathe it.