To retaliate means to get back at someone, usually through a counterattack. “Ned got hit with a cream pie, then he retaliated by throwing a bucket of Jell-O at his attackers.”
When you see the prefix re in a word, it usually means back. To return, remember, regurgitate (yuck) — all of these verbs relate to doing something back. At the beginning of retaliate it means back, and the taliate means to pay, so what you’re talking about here is payback. If you’re doing something terrible to someone just because you want to, that’s doesn’t mean to retaliate. But, if you feel they’ve done something bad to you, and you’re just getting them back? That’s when you retaliate.