@jcrabapple

This is a great example of the scientific process.

I have another theory though based upon evidence and experience.

The bird was actually flying toward the window because it saw a reflection that appeared to be a safe place to fly to.

At the last split-second, the bird realized it was glass and had an 'Oh, shit!' moment.