If you can remember to drink two huge (32-oz) glasses of water before you go to bed, you will not be hung over the next day no matter how much you drank. Unfortunately, as KPT points out, it can be impossible to remember to do this when you're drunk. Your best bet is to find a bartender who likes you and ask him to give you a glass of water with no ice between every drink once you get up to about four. Chug each glass of water in between drinks. You'll be in the head all night, but you'll feel fine the next day. Tip heavily.
Once you fail to take preventive measures, you're screwed the next day; water doesn't help after the fact. Sleep is by far the best thing, as several people have pointed out. If that's not possible, then there is almost no hangover in the world that two or three pints of draft Guinness will not fix. There's something nourishing-feeling about Guinness that really does make you feel better before it gets you drunk again. The key is knowing when to stop. (Assuming you want to, of course.)