"You shall not take revenge and you shall not bear a grudge against the members of your people" [Kedoshim 19:18]
There are times, said the Chofetz Chaim, that a man grows angry with a friend who did not do him a particular favor. Such feelings are completely unjustified.
To what can this be compared? To a man who was walking down the street, looking for his friend. As he passed people in the street, he would ask them "Have you seen my friend perhaps?"
"Try looking for him in the town square," he was told. "There are many people gathered there; maybe your friend will be among them."
He went to the town square, searched for his friend, yet he did not find him.
Would it even ocur to him to feel anger toward those individuals who directed him to the town square? Of course not! He realizes that he must simply continue his search.
The same thing applies to the prohibitions of taking revenge and bearing a grudge, said the Chofetz Chaim. We are forbidden to feel anger towards a friend who did not do us a favor. What reason can there be to be angry with him? Hashem obviously did not designate him as the one who would bestow this particular kindness upon us. We must simply turn to someone else, and place our request with him; perhaps he is the one who will be able to assist us.
If a person accustoms himself to constantly thinking in this manner, he will never bear a grudge or feel the need to take revenge.
Source: Rabbi Yisrael Bronstein