If there is a smell that attracks the bees they will find a way in to it, they don't always find their way back out. Especially where windows are involved.
Most likely there was something that attracted the bees momentarily, such as splashed syrup, and the bees found it, consumed it, and then got disorientated on their way out by the window. After a few hours of frenzied activity buzzing the window the bees tire, and dropping out of flight becomes more frequent, they they begin walking, then staggering, and finally die.
For more on the subject put a bee in a jar and watch what happens.