Why do people cheat instead of just leaving the relationship?

I genuinely don't know the answer and I do want to understand why this happens.