updated tl;dr for most of you lately:
Your problem is probably that you flashed a new ROM or kernel recently, which causes battery stats to be very inaccurate. The most common symptom is that suddenly the battery drains like crazy, when before it just dripped. The opposite can also happen - you flash a new ROM and it seems like the best battery life ever. Until it suddenly jumps from 60 down to 10. This can happen even if you erased stats after flashing. You need a few days with your new ROM first, then you should see what your battery usage is really like. Do full charge cycles to speed up this process. (Bump charge, erase stats, drain, charge, don't bump charge or erase stats anymore, drain, charge, drain, charge, etc.) Simply put: you cannot judge battery performance after flashing a ROM. Often it can be a week or more before battery performance and battery level reporting becomes stable.[/tl;dr]
Every time a chef makes a new ROM available, or even among those using stock OS, there seems to be wildly inconsistent feedback on battery life. Many report catastrophic battery drain, while others using the same hardware/firmware/kernel/ROM say it's the best battery life they've ever gotten.
It would seem that a battery can run away on you for a variety of reasons, and flashing back, or returning to the store, doesn't have to be the first thing you do to fix it. This thread is to consolidate many of the complaints around xda about sudden battery drain, and discuss proven (or superstitious) fixes for it. This is not another discussion on tips and tweaks to extend battery life. There's a good wiki on that already. This is specifically about when you experience an unexplained dramatic increase in how fast your battery is draining, and the usual tweaks aren't having any effect.
And, in some cases, if you are experiencing battery drain associated with one of the "more interesting" issues below, you might be experiencing lag for the same reason. Please attempt all of the below to the best of your ability before making a post about battery drain or lag with a particular ROM or kernel.
We'll start with the simple.
Don't rule out your imagination or neurotic behavior as the main problem.
I hate to open with a "shut-up-noob," but this one is real. I know I've almost fallen victim to the disease of "let me turn on the screen just one more time to check the battery %." Or hours of "man this new lagfix is great watch how fast I can swipe screens and load apps over and over!" Both of which, obviously, result in more battery usage. Then there's also the case where you just installed a numerical battery meter for the first time, and watching it tick down is weighing on your psyche much harder than the previous, barely noticeable movement of the bar and making you think your battery is draining wildly. Which then can also then lead back to disease #1 in a vicious cycle of psychosomatic battery abuse.
It may just be the battery itself. Some are reporting an apparent quality control problem with the batteries. You might get a great one, or if nothing below helps you then maybe you got a dud. I can't help much there. Try reporting the problem to AT&T or Samsung. I hear AT&T is a lot better to deal with.
Check the basic battery usage stats. Settings -> About Phone -> Battery Use. This won't necessarily tell you a whole lot, it isn't always accurate, but it can give you an idea of what the system thinks is using most of the battery. Such as whether it's playing with the screen too much, or making a lot of phone calls, etc. Keep in mind... I'm pretty sure that these stats are only based on the time period listed at the top of the screen. A lot of people get confused when it shows the display using 90% of the battery. But if that's only based on the 30 seconds since you unhooked the charger, then it isn't all that confusing anymore.
Be wary of the "battery full" status. I have repeatedly found, at least in leaked 2.2 ROMs, that this alert actually goes off long before the battery is finished charging. This bug often continues even after you've done all of the other various tricks and tweaks and recalibrations. It says "100" and that the battery is full and to disconnect the charger, but when you disconnect, it instantly drops into the low 90s and drains quickly from there. Rather, if you ignore the alert and keep charging for considerably longer, it will actually be at 100 when you disconnect, and will drain slowly.
Drain and charge.
Sometimes the battery meter will seem to plummet, but then sit at <10 for hours before it finally shuts off. Giving a full drain may help calibrate where the "zero" really is. Run a long video, or just leave the camera up, until it shuts itself off. Then charge it back to 100%.
The bump charge (now commonly referred to as recalibrating).
Maybe your phone forgot where zero really is, or maybe he forgot where 100 really is. Here's the bump charge. Read carefully; I did it wrong for a while before I got it right. Charge the phone to 100% while it's on. As soon as it hits 100%, unplug the charger and power off. Now plug in the charger while the phone is off, and charge to 100 again. As soon as it hits 100, unplug the charger and power on. Wait until it boots completely, then don't charge this time, just power right back off. Now charge to 100 one more time with the power off. Power on and you are bump charged. Many also consider a stats wipe to be essential to this process as well. See below.
See joeybear's post (linked below) for more info on bum charges and battery stats, such as different procedures for CyanogenMod.
Erasing the battery stats (for you rooters/flashers)
Sometimes you just want your phone to forget everything he thinks he knows about his battery, and re-learn it from scratch. Your phone maintains a file with statistics on battery usage, which in turn is used to help calculate battery life at any given time. Sometimes, especially if you've been playing with ROMs, kernels, and lagfixes, the stats in the file just aren't applicable anymore to how the hardware is being used, so you get crazy battery drain.
Clockwork Recovery has a simple function to wipe the battery stats. If you can't run Clockwork, use ADB or a terminal emulator (search the market) to delete that battery stats file located at /data/system/batterystats.bin. The link at the bottom to joeybear's thread has a little more info.
The general idea is to start by trying the above - make sure it isn't your own fault or maybe just a bad battery, then drain, bump charge, and wipe stats - in that order.
There are lots of ideas about what may or may not happen when you experiment with the above. Wiping battery stats after a ROM flash that already wiped them for you is at least redundant and may even contribute to a battery drain problem. Some say you should wipe first and then drain and bump charge. Be careful about wiping stats and bump charging too much, though. Over-charging your battery will hasten its demise.
HOWEVER, if you're like I was when I first started this thread, you've seen the above recommended many times, and none of it has ever helped you one bit with an actual sudden battery drain problem.
Now for more interesting work.
Occam's razor. The simplest answer is the most likely. Battery appear to be suddenly draining faster? Well, it could be that you need to retrain your phone (or your mind) by using the procedures above. It could be that your battery suddenly went bad. A more simple answer is that something is draining your battery. Something is abusing your CPU, your memory, or your network interfaces. Try to find out what, or at least stop it even if you don't find out what. Simply looking at the stock report of battery usage isn't likely to tell you everything you need to know, though.
If you've recently flashed something, try your flash again, and this time be more aggressive. Make sure you turn off any lagfixes you've installed beforehand. Make sure you've got the most charge you possible can before flashing (see above - you want a true 100% charge immediately before flashing). Take the plunge and opt for repartitioning, data wiping, formatting, master clearing, or any other options you may have to start with a clean slate with the new ROM. Even flash stock first. Pay close attention to battery usage as you re-install apps and get your phone set up again. It may be one app in particular that was responsible.
Uninstall all task killers. Yes, uninstall. I know task killers are supposedly battery savers, but 99% of you (including me) don't know what we're doing when we get our hands on a good task killer. It is very possible you've got one service that is constantly trying to load and call home, and another that is constantly auto-killing it. If you really want to include task killing as part of your phone maintenance and battery tweaking processes, then download an app that is specifically designed and configured just for battery efficiency, not a general-purpose task killer that will allow you to hose up your Android system.
Check your background syncs. Experiment with turning them off, one at a time, and see if there's improvement. The app may have gotten confused after all your flashing and is doing something crazy as it syncs. If you isolate one that makes a difference, reinstall it or try living without it.
Live wallpapers. They actually improve your battery life, no lie. Ok, actually that is a lie. Some of them look awesome, but many users, myself included, experience a significant increase in battery drain when there's a fancy full-screen animation running non-stop on the phone. Try getting rid of them and see. There are some nice, simple, dark wallpapers that don't animate but are still pretty enough to impress the ladies at the bridge club. Live wallpapers can also create some majorly noticeable lag in your other apps, too.
Install OSMonitor. Set it to sort process by load, descending order. There shouldn't be much in the list, the OSmonitor app itself should show up near the top, at around 20%. Other apps should be in a 0% wait state or occasionally grabbing a few %. If you recognize an app sitting consistently at 50%+, that could be your problem. Make sure you know what it is first (not a critical system service) and try uninstalling it.
Is kswapd0 taking a lot of CPU? This is the memory swap / page file process. It's normal for it to be grabbing little chunks of CPU here and there, but if it's sitting at a high %, or jumping in frequently to a high %, then something's going on with your memory cache. Unistall your lagfix and try a different one. If you aren't using a lagfix, get OCLF and use it to install EXT2 and then OCLF V2+. Despite the changelogs and debates that claim otherwise, several have found OCLF to be very useful after flashing to any Froyo ROM (unless that ROM already includes a lagfix such as voodoo or stumpy's). If none of that works, your kernel may be the problem. Swap it or go back to stock.
Look at data/network usage. If you have a router or other device on your home wireless network that can give you some info, try that. Does your phone appear to be trying to send or receive an unusually high number of packets/data even when you're not doing anything with it? Also, while off wifi, watch the little green and red data icon in you notification bar (the 3G / E icon). Are they spasming green and red constantly every 2 or 3 seconds, even when you don't think you're doing much data transfer?
OSMonitor can also again be your friend here. Under "Network" you can expand each interface and look at live data transfer #s. Does one of them seem to be really active despite you not doing anything in particular with your phone right now?
If you have any of these signs of heavy data usage, go back to OSMonitor and look at Connections. Turn on DNS reverse lookups in settings. Turn on some whois. Ignore any loopback (127.0.0.1) and likely you can ignore the 1e100.com stuff, that's just Google (get it? 1x10^100). Are there any other established connections? Does the reverse lookup (the domain name) indicate what application might have the connection open? For example, if it's weather.com, that might be a Weather Channel widget or app. That one was responsible for destroying my battery one time. Use whois and similar tools in OSMonitor and on the Internet to help you figure out what your phone is connecting to. If you've got heavy data usage and an app or apps have open connections, uninstall / reinstall those apps and see if the battery drain stops.
Under-volting. Xan's Voltage Control App. There's a lot more of this going around now that there are several overclocking and undervolting kernels available. There isn't a whole lot to be said here. Different CPU clock steps can be individually adjusted to pull a little less juice from the battery. Make sure you keep them as temporary settings and do not "set on boot" until you're sure you've got a stable configuration. If you set something to a level your phone can't handle and script-save it for booting, you might not be able to boot again. Anyway, under-volting will not suddenly revolutionize your battery performance, but it can help.
Also, switching UV settings can significantly affect your battery meter after reboot. If you've recently switched UV settings and rebooted, your battery meter might suddenly show 20% more or less batterly life than before. This is simply what the meter thinks to be the case, obviously your battery did not just jump 20%.
Backlight notifications. I don't have hard data to back it up yet, but I've noticed that when a backlight notification is active, my battery starts racing to zero.
Cyanogenmod. It's available on Captivate now. It isn't stable/supported. It has a lot of debug code enabled. That means it uses more battery than it will someday when it's stable RC and debug code is commented out.
I've successfully used all of the "interesting steps" above in different cases where I had sudden battery drain and the basic steps didn't fix it. Anyone else have success with these? Any other tactics to share? Please post.
Thanks to joeybear23 for good info on recalibrating the battery.