Musically speaking, "If I Were a Boy" hardly varies at all from the verses to the chorus.
This lack of variation works because of Beyoncé's incredible singing. Beyoncé isn't afraid to use a vocal technique called melisma. Melisma, a favorite of American Idol wannabes, is a technique in which a singer moves between several musical notes continuously while remaining on the same syllable. Singers like Knowles and Mariah Carey have been criticized for overusing the technique to the point that it detracts from the melodies, with one critic saying, "as judicious as [Beyoncé's] singing can be, the effect in sum is still like being hit in the head with a fist in a velvet glove" (source).
But it's largely a question of taste, and Bey puts melisma to good use in this song.
So, we're clear that Beyoncé gives a great performance. But in terms of melody and chords, the main feature in "If I Were a Boy" is repetition, not musical innovation.
To explain what's behind the repetition, we looked to Toby Gad, the co-writer with BC Jean. Gad, who co-wrote "Big Girls Don't Cry" with Fergie, is partially responsible for at least 12 other Billboard hits. It might be appropriate to think about "If I Were a Boy" as part of the commercial pantheon of what some people call "corporate pop," pop written by behind-the-scenes producers who steer the music toward what market research and musical trends say is a radio-friendly and successful sound.
What comes of that is an emphasis on hooks and catchy progressions, both defining elements of this song. People remember the melodic hook of "If I Were a Boy" even if they hate the song because it's a great melody. Just like "Single Ladies (Put a Ring on It)," "If I Were a Boy" seems engineered to get stuck in your head. And once again, whether that's a good thing or a bad thing is a question of taste.