(Although mostly attributed to Machiavelli, the phrase "the end justifies the means" is not one of his creation.)
The basic interpretation of "the end justifies the means" is:
"At the beginning of an action I might not be able to determine whether that action is morally right or wrong, but when the morally right goal is successfully achieved, then the steps which led to it must be morally right too."
When a little twist is introduced to this interpretation, it becomes:
"I shall do a minor evil to achieve a greater good." or
"My aim for greater good makes all the evils I have done right."
If we set the game of morality aside, "the end justifies the means" becomes "the result proves
the means to be efficient" - which is somewhat obvious.
What can we learn from "the end just justifies the means"?
From a moral standpoint, we can say that the morality of an act can be determined only at the point in time when it is committed; we have to make a decision with insufficient information, and it is only the intent at that point which determines the morality of the action.
On the contrary, if we would presume that the morality of an act can be determined at a later time with more information present, then we could conclude that we could determine it with greater accuracy at an even later point in time - and so on, at which point the question of morality loses sense.
Morality aside, "the end justifies the means" teaches us not to shoot ourselves in the foot:
If the vision, the goal which we have set ourselves is incomplete, then the worst thing that could happen to us is to accomplish that goal with all means necessary.
At that point, we would realize that the goal we have set ourselves is not the goal we have desired - we have failed to clearly create our vision.
By focusing only on a small part of the complete vision, we may ignore and mess up the rest.
Be careful what you want, because you might get it. And when you do, no amount of justification will help you.