It oxidizes the eumelanin and pheomelanin pigments.
By itself, hydrogen peroxide will do some lightening, but for hair bleaching it is usually combined with ammonia. While any alkali will make the scales on the hair shaft open up to let the peroxide in, ammonia actually breaks down the little packages (called melanosomes) of melanin particles, allowing the bleach better access to them.
Melanins come in many forms, but most are similar to the molecule shown in the drawing above. Like any dye or pigment, the ability to absorb a particular color comes from the alternating single and double bonds (single bonds are shown in the picture as single lines, and double bonds are double lines).
When a molecule has single and double bonds right next to one another, the electrons that form the bonds usually spread out over both locations, so we actually think of the two bonds as being “one and a half” bonds. This is important, because in a dye these “delocalized” electrons resonate with the light, at a frequency that depends on how many bonds they can cover.
If there are lots of delocalized electrons in a molecule, the light they absorb will have a long wavelength, like red or infrared. If there are only a few, the wavelength will be shorter, like blue or ultraviolet.
Reacting the molecule with hydrogen peroxide causes oxygen atoms to attach to the molecule. This usually turns one or more of the double bonds into single bonds. This means the molecule no longer absorbs light the same way, and is either a different color, or loses its color altogether.