Apple can tell in several ways: first, drinks like coffee, tea, soda, etc., especially ones with color or sugar leave residue as they dry inside the computer and they're usually easily visible. If they aren't dried quickly, or if they have sugar, you'll find all kinds of corrosion, I've even found mold inside a computer. Also, newer units have liquid contact indicators like cell phones do, they change in color when exposed to liquid. Don't worry, humidity won't set them off (at least not in typical conditions, I'm not saying it's impossible but definitely improbable), but if they're tripped it voids the warranty (there are further conditions to this but not worth explaining unless someone wants to know).
The trouble with spills in newer unibodies is that the battery is integrated, meaning you can't fully remove power. Liquids like coffee, tea, soda, that are largely H2O based, are very conductive. If they connect two traces together that shouldn't be connected, you will/can short various components/boards. Even if the computer is off, there's still what's called 'trickle power' flowing through the system so it can turn on when you hit the power button.
People report problems weeks or months down the road because it often takes time for corrosion to build up (depending on the climate and substance that was spilled) leading to failures after-the-fact. Also, shorts that may occur while there's still standing liquid may not necessarily cause immediate failures. They're the kind that can cause weird, annoying, intermittent problems.