When someone does something nice for you, and you do something nice back to them, you call that "returning the favor":
You've helped me out so much, so I just wanted to return the favor.
But the phrase "return the favor" now has a wider meaning than just doing something nice in return to a person. Now it can have a more general meaning of "doing the same thing back to someone that they do you".
It's mostly used with positive actions, but it can also be used with some negative actions too in an ironic way. For example, if you're playing chess with someone and they take one of your pieces, you can say this when you take one of theirs:
Allow me to return the favor.