"The School Boy" uses several kinds of repetition, mainly for the purposes of emphasis and comparison/contrast.
First, it repeats a number of thematically important words, including "summer" (four times), "bird"/"birds" (twice), "sing"/"sings" (three times), and "joy" (four times). All of these words relate to the speaker's natural, youthful exuberance—what he feels in the morning and would feel the rest of the day, if not for school. Essentially, he wants to be as joyful as a bird singing in summer! And while school hasn't crushed his spirit yet, it's coming dangerously close. ("Summer" weather and "birds" are also literal features of the poem's setting.)
In lines 1 and 6, repetition helps the speaker draw this emotional contrast more directly. Whereas the schoolboy "love[s] to rise in a summer morn," he hates "to go to school in a summer morn." The parallel phrasing here emphasizes that summer should delight this child, but thanks to school, has disappointed him instead.
Finally, the poem uses anaphora to drive home the speaker's points and underline his frustration. In the fourth stanza, for example, the repeated "How can" suggests a tone of pleading or indignation:
How can the bird that is born for joy
Sit in a cage and sing?
How can a child, when fears annoy,
But droop his tender wing, [...]
Similarly, the last stanza repeats "Or" to convey an insistent tone, and to suggest a pile-up of potential consequences:
How shall the summer arise in joy,
Or the summer fruits appear?
Or how shall we gather what griefs destroy,
Or bless the mellowing year,
When the blasts of winter appear?
If his youthful exuberance is suppressed, the boy warns, he won't flourish in his early or later adulthood—the "summer" or the "winter" of his life.