An author's decision to use second-person-point-of-view has to do with the didactic style of the poem, but using second person pronouns lend the author's theme and message a universal quality. In a sense, the author uses "you" to reach all readers despite the circumstances of the text. Even though the author is speaking to his son, the author's message relates to all persons.
Rudyard Kipling's "If" is a didactic poem. A didactic poem is used in order to give instructions on something. In the case of Kipling's poem "If," he provides instruction on being a man. While many have suggested that the poem was written for Kipling's own son, Kipling himself attributed the poem (in Song to Myself )to "the Scots-born colonial adventurer Dr Leander Starr Jameson" (Wansell).
As for the use of second person, the poem is written with the speaker (a father) talking to his son. The multiple second person pronouns (you, you'll, and your) allow the speaker to address the reader as well as his son. This technique draws the reader in because the speaker is directly addressing "you."
That said, there is a simple problem here. Female readers may feel alienated by the poem, but this will not happen until the final line. Throughout the poem, nothing is said which identifies the gender of "you." It is left ambiguous, until the final line where "son" appears. This can alienate some female readers because they are daughters, not sons.
Regardless of the insinuations which are made regarding who the poem was written for and if the poem alienates female readers, Kipling most likely wished to simply draw readers in and offer them the same type of fatherly information their father may have given.