"If" is a father's advice to his son about how to live his life so as to achieve the respect of others and, more importantly, a high standard of self-worth in society. The advice is given as a series of contrasting situations, suggesting a situation and two ways of reacting to it - the first not a good choice, the second one preferable.
In the first stanza, the son is encouraged to believe in himself and to stand up for his beliefs even when others disagree; at the same time, the son is warned against discounting the possibility of value in the ideas of others.
If you can keep your head when all about you are losing theirs and blaming it on you, If you can trust yourself when all men doubt you, but make allowance for their doubting too
The second stanza counsels the son to work to achieve his goals but not to lose himself in the process and not to become discouraged by the criticisms of others. "If you can bear to hear the truth you've spoken twisted by knaves to make a trap for fools..."
The third stanza uses exaggerated language to emphasize the importance of not connecting self-worth with the achievement or loss of any specific goal. The important thing is to remain true to personal convictions and to continue to work for worthwhile purposes, even when others don't.
In the final stanza, the father reemphasizes the importance of treating all persons equally, at the same time maintaining personal honesty and honor.
If you can talk with crowds and keep your virtue, or walk with kings nor lose the common touch, If neither foes nor loving friends can hurt you, If all men count with you, but none too much
Concluding, the father proclaims that, if the son is able to follow this advice, he will achieve whatever in the world he wishes to accomplish. Most important of all, in the father's view, the son will attain complete and honorable maturity. "You'll be a Man, my son!"