Drinking alcohol plays a number of tricks on your body that set you up for a rough morning. It tells your pituitary gland to stop producing vasopressin, a hormone that helps you retain moisture. Without it your liquids go to your bladder, which is why you have to pee all the time when you’ve been out drinking. Fast forward to the next day and you’re extremely dehydrated. You’ve peed away things your cells and muscles need to function -- like salt, magnesium, and potassium. And your other organs have stolen water from your brain, causing it to literally shrink and pull on the membranes that attach it to your skull. Consequently, you have a horrible headache.
On top of all that, there’s a byproduct of alcohol that can make hangovers even worse. The most common way your liver breaks alcohol down is a two step process, and unfortunately the first step turns alcohol into acetaldehyde. Acetaldehyde is highly toxic and makes your headache and nausea worse. It’s also a known carcinogen. If you’re drinking at a moderate pace your liver can break it down into the more benign acetate. But drink too much and the enzymes can’t keep up, so we get a buildup of this nasty acetaldehyde.