Spring is mating season for birds. Birds see their reflections in a shiny surface and assume it is an opponent to the object of their affections. The pecking is the attempt to drive it off and keep the mate field limited to just themselves. Even when it is not mating season, birds cannot distinguish themselves from a reflection. They want to chase off the interloper who challenges their territory. We have a cardinal family that does this to my husband's truck-the bumper, the mirrors, the windows, anything shiny. The mother cardinal is the worst offender. I guess she's afraid papa bird will run off with another woman (but I don't think birds emulate people). You might try putting some pictures in the window, especially of predators. That would scare the bird off. Luckily, it is just a nuisance and not dangerous (except for the bird poop that tends to pile up).