Why does a bird keep flying and banging into your window?

A bird's eye sight does not allow it to see a pane of glass. Or, more accurately, its brain cannot identify the window as a solid object. All it sees is the outdoors, and freedom.