What does this line from the poem mean? "And treat those two imposters just the same ;"
The "two imposters" that Kipling is referring to are Triumph and Disaster in the line before this one. Kipling's If is a poem about the rites of passage for a boy becoming a man. When men (and women) meet with Triumph (capitalized to show its strength in being personified) we tend to let it go to our heads. We get arrogant and maybe we might treat those who lost as if they were less than ourselves. That is a great deceit, lie, or "imposter" as Kipling puts it. We deceive ourselves that we are greater than others when we accomplish something great; and, when that happens, we aren't being true to ourselves or others.
The second imposter is Disaster. When we as humans meet with disaster we have two choices; either we hold our heads up high and rebuild or we can shrink, get depressed and give up. Sometimes we think that there couldn't be anything worse happen to us when we face adversity on a higher scale than we ever seemed to have faced in the past. It's during these moments when we can be deceived and lose our way from what might be a healthier reaction.
Imposters deceive. If we can look at both of them with an objective eye and not get too caught up in their temptations, we might be happier and find a better outcome to the situation.