Getting back with ex-husband

I coul dbe wrong but I always thought it was like this:
You get re-married to another man, not like with intention of divorcing him ASAP. Then if you happen to get divorced, then you are able to re-marry ex-husband. Almost like a way to punish the guy for divorcing…I am guessing out of anger otherwise why would he want to re-marry the lady again?