It's usually because of some injustice done to them, so they are going to have an eye for an eye. Sometimes there are thousands of years of distrust and hate. At a gut level, it makes sense. You have to show them they can't get away with it. But what really happens is in inflicting the repraisal kind of justice even more people get hurt, and they have to retaliate to even the score.
Retaliation can only escalate.
And when different cultures are involved, suspicion is already high and hatred can easily be generalized to encompass everyone in the other culture. Terrorists thrive on polarizing people with this kind of tactic. Two opposing groups are forced by a common enemy, possibly a natural disaster, to temporarily work together in order to survive. They discover ways they are alike, but the bonds of hate are not broken. Both sides have leaders and strong groups who push them to remain separate because of past injustices.