If you can keep your head when all about you Are losing theirs and blaming it on you; (1-2)
The important, stoic principle of maintaining control is expressed right at the beginning of the poem. The whole idea of "keeping one's head" applies to other stoical ideas in the poem: not giving in to hate, not despairing over defeat, and not giving in to physical exhaustion.
If you can wait and not be tired by waiting, Or, being lied about, don't deal in lies, Or being hated don't give way to hating, (5-7)
Stoicism is about being patient and about not giving in. These lines say it best. "Don't deal in lies," and "don't give way to hating." Hating, lying—these are negative things, and giving into them is a way of losing control of one's emotional equilibrium.
If you can dream---and not make dreams your master; If you can think---and not make thoughts your aim, If you can meet with Triumph and Disaster And treat those two impostors just the same: (9-12)
We meet the idea of control again, this time with dreams and thoughts. The neatest thing about these lines is the rhyme on "master" and "disaster." The poem very cleverly tells us that a key aspect of stoicism is mastering disaster—emotional, literal, or any other kind.
If you can bear to hear the truth you've spoken Twisted by knaves to make a trap for fools, (13-14)
We again see a connection between stoicism and endurance. Here, that endurance takes the form of being able to watch "knaves" distort one's words in order to deceive people. Being able to "bear" something implies being able to observe without overreacting, getting too upset, and the like.
Or watch the things you gave your life to, broken, And stoop and build 'em up with worn-out tools; (15-16)
The key word is "watch." Note that there is no mention of things like "get upset," "throw a fit," or "sulk." Nope. This is because to be truly stoic is to observe what has happened and to go about fixing it, without getting all bent out of shape.
If you can make one heap of all your winnings And risk it on one turn of pitch-and-toss, And lose, and start again at your beginnings, And never breathe a word about your loss: (17-20)
These lines pick up right where lines 15-16 left off. This time it's not about "watching," but rather about "not breathing a word" about one's loss to anybody. These lines reiterate the point that, to be stoic, one must start over at times—without making a fuss.
If you can force your heart and nerve and sinew To serve your turn long after they are gone, And so hold on when there is nothing in you Except the Will which says to them: "Hold on!" (21-24)
Stoicism is also about strength and endurance. Just look at the language in these lines: "force," "serve," "hold on," "Hold on!" It is just as important to press on, even when you feel like your body is broke, as it is to calmly endure disappointment.
If neither foes nor loving friends can hurt you, If all men count with you, but none too much: (27-28)
Stoicism is about making oneself invincible, as much as that is possible. Friends hurt us, and so do foes, but we should always try to not let that happen. We need to put on metaphorical armor if we want to succeed.
If you can fill the unforgiving minute With sixty seconds' worth of distance run, (29-30)
The strength and endurance aspect of stoicism is brought up again, this time with a metaphor about making the most of an "unforgiving minute." Life is short, that's for sure, so you might as well stoically do the best you can—go the "distance," as they say.