Drains block up when solid material being flushed down them adheres to the side of the pipe, forming an obstruction that gathers more material, until the cross section of the pipe is completely obstructed, and no more water can flow. Drains in both kitchen sinks and bathtubs generally block up with organic material - potato peelings, skin, etc.
To unblock a drain, you need to get the material that's clogging it up out of it, either by dismantling the drain and removing the blockage, or by flushing the blockage downstream to a wider pipe. There are two main methods of flushing - using a high pressure to force the blockage out, or using strong chemicals to cause the blockage to break up.
Chemical methods include strong alkalis and bleaches. The thicker the chemical, the more of it will sink through the drain to act on the blockage without dissolving in the backed up water. It is important to remember that the blockage is made out of the same kind of stuff you are, and anything that dissolves it will also dissolve you quite happily. Wear rubber gloves when handling these chemicals, and when putting your hands in backed-up water if they don't shift the blockage. The simplest chemical method is boiling water - poured from a height directly over the plughole, it will sink quickly through the standing water, and melt away fatty deposits that tend to form in kitchen drains.
Mechanical methods include the good old plunger, more advanced pumps, and disposable cans of compressed air. These work by creating a high pressure on the blockage, unsticking if from the pipe and blowing it down the drain. It is important to ensure that anywhere the pressure can escape that isn't through the blockage (the overflow, for instance) is covered up. If the overflow is not fitted properly and the blockage is stubborn, the overflow pipe may come loose. This is A Bad Thing, as the sink/bath may drain out the overflow pipe onto the floor. If you feel this is a risk, it may be a good idea to make sure the drain is accessable before doing anything to the plughole.
The final mechanical method, usually left to the professionals, is the use of a drain rod. This is a flexible rod with a brush on the end, which sweeps the whole cross-section of the drain in one go, pushing blockages and adhesions down to a wider pipe where they may be swept away. This is typically done on larger pipes such as toilets, or (god forbid) the main drain for the house, or pipes too inaccessable to easily dismantle. It can be approximated by using a long wire (such as a coathanger), but this will typically just poke a hole in the blockage, allowing water to drain, rather than get rid of it.
While drains in kitchen sinks block up with small particles, bathtubs often have to contend with hair. Long hairs can form into a long tangled snake, acting like a filter to trap smaller material passing down the drain, until the entire pipe is full of hair and muck. These kinds of blockages are almost impervious to mechanical methods and milder chemicals. A good sign that you've got a hair blockage to worry about is when 'unblocking' the drain does get water flowing again, but the flow is very slow, and the drain soon clogs again.
The strongest of chemicals can dissolve hair. These are typically sold as 'drain bombs', or similar, and are very dangerous to get on your skin. If you don't want to use these (for instance if you're worried about it damaging the pipes, or killing your septic tank), you're going to have to dismantle the drain and clean it out.
Dismantling the drain
To do this, first get the water out. If there's not much water, it may be cheaper to simply bail out the bath, pouring the water down the toilet. Otherwise, try to unblock the drain by conventional methods until the water drains away. Poking it with a coathanger may work if all else fails.
Next, gain access to the drain plumbing. Most baths have a removable panel that covers the side, allowing access to the underneath of the bath. Open it up, place a bucket or basin underneath the plug assembly, and unscrew it from the bath. Depending on your bath, it will either screw on from the underside to a fixture built into the bath, or it will sandwich the bath between the pipes and the plughole. In the latter case, the sandwich is typically held together by a screw in the middle of the plughole. When you undo the assembly, it is not unusual for some of the water caught in the drain to come out. That's what the basin is for.
Having taken out the plughole, you should be able to see the blockage. Gross, huh? Pull out as much as possible into the basin. You may have to work your way down the drain pipe, unscrewing sections as you go until you've got all of it. Once it's all gone, the sections simply screw back together. Tightening them as far as you can by hand is good enough. Make sure you don't lose any of the rubber washers that go between the sections. For the 'sandwich type' plughole, make sure to reassemble it and screw it together before testing the drain, as it is not waterproof until screwed tight.
Throw the contents of the basin in the bin. Don't flush it down the drain, or you'll be back where you started. Test the drain to see if water flows down it freely, and doesn't drip from any of the sections you took apart. If the drain can cope with a small amount of water, test it with the taps on full. If the drain doesn't flow freely even after taking apart all the visible sections, or if you took all the visible sections apart and couldn't find a blockage, or if you have a leak that won't go away even after making sure the washer is present and the threads have engaged properly, call a plumber.
Caveat lector: I am not a plumber, nor do I play one on TV. I don't enjoy paying call-out fees and have done this procedure before, however every drain is different and if you feel at all uncertain at any point it may be better to call a professional than risk flooding the house.