Birds hit windows repeatedly because it’s a territorial behavior. Usually, when a bird, including the cardinal, is looking for a nesting spot, and they, by chance, see their reflection on the window, they’ll mistake it for a predator or an enemy and start to hit the window in defense.