Birds have a very interesting relationship with windows and glass that's not unlike a baby seeing a mirror for the very first time. If they are not initially confused by the reflecting glass, they sometimes miss seeing glass all together and crash into it head first, which is usually lethal. Other times a bird will peck at the window, which is annoying and distracting. If you keep having this issue, here is some more information on why they do it and how you stop them.
Why do birds peck at the glass?
While there's plenty of evidence that birds are highly intelligent creatures, they are not as smart as humans when it comes to abstract concepts like the idea of self and reflections. When they pass by glass that reflects the world and see themselves, they think it's another bird threatening them. In order to defend its territory from what appears to be an intruding bird, a bird will peck at the reflection on the glass. Not wanting to be the one to back down, the bird will continue pecking at the glass for several minutes.
If this happens once or twice, it is probably just a little alarming, but constant pecking has been known to cause breaks and cracks in the window. There are a couple solutions similar to those that prevent birds from crashing into windows.
How to deter the birds from pecking at your glassPlace a barrier between the bird and the window
In order to keep the bird away from your window, place some sort of barrier over the window like a mesh cover or screen on the outside. This prevents the bird from being able to peck at the window and will take away the reflection of the window.
Remove the reflection by placing art or decals over the window
This solution tackles the root of the problem by preventing the bird from seeing itself in the glass, but alters the appearance of the window. There are a variety of decals or window art you can put on the window to hide or limit the reflection. They range from very campy art to less noticeable decals like this one, which looks like a spider web. Another option is a decal only visible to birds that will deter them from flying into and pecking at the window.
Close the curtains to minimize reflections
If you're not interested in putting anything over the window, simply closing the curtains will take away the reflection and present a solid background. Birds are usually most aggressive during spring when they are defending their territories, so the curtains wouldn't need to be closed all the time.