Our brains operate on the expectation of future reward (everything from water to praise to a slot machine payout). We're very bad at judging relative sizes of reward and how much investment is required to get them. Also it's not just the act itself that is a reward.
Immediately after orgasm, one is extremely unmotivated by sex. Try it out and then realise how irrational you are the rest of the time.