Rudyard Kipling's poem "If" is considered a Didactic poem. The Didactic poem comes from the Greek word didaskein (which means "to teach."). Poems of this type are meant to teach the reader about something very specific (life, love, decisions, etc.).
In regards to Kipling's poem (stanza one), the speaker tells the reader about the importance of keeping one's head when those around them are not, being true to one's self when others doubt, lying, patience, and hatred. The second stanza refers to the importance of having dreams (while not allowing the dreams to rule life), the ability to think (while not letting thinking rule life), knowing truth, and having the ability to fix things with the tools a person already possesses.
The third stanza teaches the reader about holding on and letting go (using a metaphor of gambling to illustrate the point). The fourth stanza teaches readers about the importance of knowing who they are, even when surrounded by "crowds" and "Kings." Here, the speaker is instructing the reader about the importance of being who one is regardless of the possible influence of those around them.
Essentially, the entire poem is offering the reader instruction on how to be a good person in the conflicting world around them. Kipling offers, through his speaker's voice, suggestions on what it takes to be a good person: "if" they do as the speaker suggests.