Racking a brew refers to the process by which you syphon the good liquid off the lees at the bottom of the fermenter. This is done so you get rid of the icky bits (the lees) so that the brew is as crystal clear as possible. This is generally done just before bottling, but some recipes call for another rack partway through the brewing process.
The liquid could just be carefully poured off, but this often disturbs the lees as you go - and it's hard to stop halfway through. It's also much more difficult to pour from a 5-gallon container than a 1-gallon one.
What needs racking
Racking a beer generally isn't as necessary as most beer fermenters have a tap installed near the bottom that takes the liquid from above it - and so beer can be bottled straight from the fermenter. The tap is generally installed a few centimetres above the bottom of the fermenter - and so the lees are left undisturbed below that level.
Wine sits in the fermenter for a much longer period of time, and so is generally done in glass fermenters - which are usually untapped (much harder to do than plastic). Thus racking is required.
Another reason wine is racked is that it must brew for much longer periods of time, and if it sits on the lees for many months, the lees can start to impart a musty odour to the wine (which is not preferable). Thus, long-brewing wine recipes will instruct the brewer to rack about 6-9 months into the ferment. this obviously occurs regardless of how "clear" the wine is - but generally you can tell the difference between the wine and the lees.
What you need to rack
Racking a wine is no different from syphoning any other liquid. You need:
A second container of equal or greater size to the container you are racking from. This is a very important point as once the syphon starts, you have to stand there and hold it and can't rush off to get another container. You can have multiple containers but you may get some spillage as you pass from one to another.
A high, stable place to put the first container onto. Syphoning works by gravity causing the liquid to go from one container to another - so you must have a stable place on which to put the fermenter it's flowing from.
A syphon - generally a length of non-toxic plastic piping. The clear water-pipe from the hardware store is good and pretty food-safe too (at least for the short period of time you'll have liquid going through it). You'll need about 1.5/2 metres - enough to reach from the bottom of your first fermenter, up to the top of it, then down to the floor from whatever high place it's sitting on. If you do a lot of racking, you may wish to invest in a siphon that has an inbuilt pump.
The racking process
Please read through the entire process before starting as you won't be able to consult anything partway through the process.
Step 1: Put your first fermenter on the high place
Step 2: Wait until the lees settle as moving the fermenter will disturb them. About an hour should do it - unless the lees are very fine. I generally put the fermenter up the night before I'm going to rack, just to be sure.
Step 3: Put your second container on the floor
Step 4: Put one end of the syphon into the brew - but don't let it touch the bottom (or it will disturb the lees) - about halfway-up is best to start with.
You will now need to hold the pipe very carefully at the point where it enters the fermenter - don't let go until you have completely finished the syphoning process. If you let go it will either go out of control, spraying brew everywhere (sticky) or it will touch the lees and disturb them - in which case you will have to stop everything and wait an hour until the lees settle back into place again until you can start again.
From now on (to the end of the process) you will also need to keep an eye on exactly where in the brew this end is - if the brew is murky or dark-coloured, you will need to tip the syphon so that the end is against the glass. This way you'll be able to get a glimpse of where it is, and thus be able to guide it so that it doesn't disturb the lees or come out of the liquid.
Step 5: Now, the siphon needs to start draining the liquid into the other. If you're lucky enough to have a siphon with a pump, follow the enclosed instructions. Otherwise, you'll have to do it the old fashioned way. Make sure your hands are nice and clean, to avoid introducing unwanted elements to the brew. (Some brewers also like to 'sanitise' their mouth with scotch.) Hold the other end of the syphon near your mouth, and keep the rest of the pipe above the level of the fermenter. This is so that when you start sucking on the brew - it won't just pour down to your mouth, and no air-bubbles will get trapped in the pipe. You may need a chair to do this - but be aware it doesn't have to be lifted a great height - just enough so the liquid doesn't go the wrong way yet.
Step 6: Start sucking the other end of the syphon so that the liquid comes up the pipe. In theory you should stop when the liquid gets to your mouth... or shortly thereafter at least ;)
Step 7: "Stop" the end of the syphon either with your tongue (if you're going to be the only one drinking this stuff) or a finger from your free hand (you'll often lose a little bit of the brew).
Step 8: Lower the bottom end of the syphon into the second container and unstopper the end...
The liquid should now be flowing from the top container into the bottom container. Now all the work is in steadying and positioning both ends of the syphon.
The bottom end just needs to not be pouring liquid all over the floor. This can actually become difficult if you're paying too much attention to the top end.
The top end needs for you to be paying attention to how fast the liquid level is dropping and where the end is in relation to said level. If ever the end comes out of the liquid, air will fill the pipe, the syphoning will end and you'll have to start over from step 4 (including time to let the lees settle again), so it's really important that you keep an eye on this. As the syphoning goes on, slowly lower the end into the brew to keep ahead of the lowering liquid level.
Keep going until you get to the point where you start to suck up lees.
Then stop by pulling it out immediately.