They will do this till they drop unconscious. When they revive, they may notice another way out, or they may again try to shoulder their way out of the skylight. Sadly, even the cheesiest Home Debris skylight is too sturdy for this.
I've rescued four hummingbirds from possible death-by-skylight. One had flown into a miserable concrete bathroom structure at a beach. It was getting dark, the hut was unlit, and the only hope the bird perceived was to batter its way through the skylight. Rescue was a simple matter of clambering atop the stalls and ensnaring it in a T-shirt. (Okay, and convincing certain humans that it was a hummingbird and not the most humungous bee of all time.)
On another day, two had flown into a long overhanging veranda-but-this-is-California-so-we-call-it-a-deck and could not grasp that the skylight over the stairwell was not the way out. “There's two of us! And we're furious! No barrier can stand before us!” The skylight had a ledge below it, on which the hummingbirds would periodically drop in fatigue, acquiring nasty coats of dust and spiderwebs. Because this was over a deep stairwell, getting close enough to throw shirts over them was rather difficult.
The most recent needle-nosed fool flew into a kitchen and made the same old mistake. This was one of those amazing high-ceilinged kitchens with shelves up so far that giraffes can easily find food dishes, naturally with a large skylight, and retrieving this bird involved climbing a stepladder set on top of a granite-topped cooking island, and flailing gently with a long-handled smelt net and a tattered pool net.
The hummingbird, flagging but game, had no intention of flying into the smelt net, although he was willing to perch on its rim between assaults on the skylight. Finally he made the mistake of taking the smelt net for granted while avoiding the approach of the pool net, and he was snared. And forcibly escorted outside, and briefly admired, and allowed to fly off in a rage.