I generally always analyze a poem along two main pathways. You can take them in either order too. One way to analyze a poem is to analyze the plot, meanings, and themes. The second way to analyze a poem is to break down its structure, rhyme scheme, rhythm, and meter. I like doing the latter first, because I think that understanding the structure of the poem can highlight theme and tone shifts.
Stanza wise, "To an Athlete Dying Young" is very straightforward. The poem is made of 7, four line stanzas. In poetry, a four line stanza is called a quatrain. Together, all of the quatrains of his poem form an elegy. An elegy is a poem that has been written for the occasion of someone's death. It's not a happy type of poem, which is why Housman's poem is so disconcerting at times.
"To an Athlete Dying Young" is a disconcerting read because it sounds happy. The reason that it sounds happy is because it has some very standard, comforting poetry techniques. First is the rhyme scheme. It has a rhyme scheme and the scheme is consistent throughout the poem. The first two lines of each stanza rhyme with each other and the second two lines of each stanza rhyme with each other. That makes the rhyme scheme AABB.
The time you won your town the race
We chaired you through the market-place;
Man and boy stood cheering by,
And home we brought you shoulder-high
The second thing that helps with the poem's happy, sing song feeling is the rhythm and meter of the poem. The poem is written with an alternating unstressed, stressed syllable repetition. In poetry, that is called an iambic foot. Each line in the poem has eight total syllables, which means that four iambic feet can fit per line. That makes the poem's rhythm and meter iambic tetrameter.
Let's transition to the poem's content. Based on the title, it's clear that the poem is about the death of a young athlete. That's sad. What adds to poem's strange feeling about such a sad title is stanza one. It's a really happy stanza. It feels happy by its rhyme, rhythm, and meter, and it's about winning a race in front of a large crowd. That's a happy event.
But then Housman hits his readers hard with the second stanza. The athlete is dead and being carried in a casket for his funeral.
Today, the road all runners come,
Shoulder-high we bring you home,
And set you at your threshold down,
Townsman of a stiller town.
That shift in tone and content is the shift that your question initially asks about. But then stanza three offers up another shift. This time the shift suggests that it is a good thing that the athlete died young. What? Housman says that it's a good thing, because now the athlete will never have to have the eventual feeling of defeat. He will never have see his name slowly fade away from the public eye. In other words, Housman is suggesting that the athlete has been blessed to go "out on top."
Smart lad, to slip betimes away
From fields where glory does not stay,
And early though the laurel grows
It withers quicker than the rose.
All in all, it appears that the general attitude is a positive and cheery outlook on death. I see the poem's point, but I disagree. I currently still hold one high school track record. I held two others, and I was lucky enough to see those two records broken ten years later. I wasn't sad. I was incredibly proud of those athletes, because I know how hard they worked to achieve that goal. I would not trade an early death for thinking that I had gone out on top of my game.
Thematically, death is a definite theme of the poem. It questions the timing of death, and it forces the reader to examine when a death might be beneficial to someone. That's morbid. Pride is also a theme of the poem, because Housman is suggesting that it might be better to die happy, young and proud instead of as an old man who might not be proud of his past achievements that nobody remembers.
Hope it helps!