Many rational acts impose short-term costs on the doer with the expectation of longer-term gains. That’s true of tipping, gift giving, flushing public toilets, not littering, and lots more. Sure, you might leave a tip even though you don’t expect to be in the particular restaurant again. Tipping, however, like gift giving, is a social norm that has arisen and taken hold because we have learned that its effects on the expectations of others (waiters, dinner party hosts) are important to making our own lives a little happier and easier.