Alliteration is repetition of initial consonant sounds that come in words that are in close proximity to each other. Here is an example of alliteration from the poem "If": "If you can talk with crowds and keep your virtue, / Or walk with Kings—nor lose the common touch." This could be paraphrased as follows: if you can speak publicly, perhaps being the center of attention, and stay committed to being moral and upright, and if you can be regularly in the presence of very powerful people but don't become a snob and think to highly of yourself. The alliteration is the repetition of the /k/ sound in the bold words. The ideas are parallel thoughts, that is, the two lines mirror each other grammatically and in meaning. "Talk with crowds" and "walk with Kings" are both activities that imply one is getting ahead in the world and is becoming famous and taken note of. Sometimes this can go to a person's head and make the person conceited or make him or her abandon former friends. Either way, you should "keep your virtue," and not "lose the common touch." These thoughts are parallel ways of saying that fame would not change who you are. You would remain a good person and not treat friends who have not risen to higher levels like you have any differently than you have always treated them.
A metaphor is a figurative comparison that equates something with what it is being compared to. Here is a metaphor from the poem: '[If you can] watch the things you gave your life to, broken, / And stoop and build ’em up with worn-out tools." The metaphor is effective because it makes the reader understand the loss being discussed by using the words "broken" and "stoop," physical descriptions that describe an intangible situation. This line means that you suffer a major setback in life. Some project you tried to do, or some position you attained, fails. You then have to "stoop," go back to the beginning, and try to pick up the pieces again, starting over. The tools referred to are not physical tools but are the hard work and deep thinking that got you to succeed in the first place. Sometimes it is hard to go back and work long hours and be dedicated to something when you thought you had already achieved a level of success and comfort. This type of persistence and dedication, according to the poem, is required for true success and maturity.
One example of alliteration in this poem can be found in the second stanza. Here, Kipling says
If you can bear to hear the truth you've spoken
Twisted by knaves to make a trap for fools
In these two lines, there six words that start with the letter "t." I think that the hard sound of the "t" reinforces the negative feel of this. The sounds of "twisted," "to," and "trap" sound a little violent, just like the action.
I think that a metaphor can be found in the last stanza. There, Kipling says
If you can fill the unforgiving minute
With sixty seconds' worth of distance run
He is using running as a metaphor for life. He is saying that you have to try your hardest all the time, even if it leaves you exhausted, which is what running does.