Decanting is all about removing sediment from a wine, and allowing the wine to breathe. These are things that older, red wines do - young wines and white wines do not usually have to be decanted.
First, the sediment. Wines have all sorts of organic things in them - yeast, grape skins, and so on. The wine naturally has very small particles of these things that, over the years that wine age, settle out of the wine. That's why with older red wines, which have much more skin contact, you get more sediment.
The trick is to pour the wine slowly into the decanter, keeping the same side down that was down during the aging process. You don't want to mix all that sediment in now! Be sure not to let the sediment end up in the decanting glass. Some people, with a bottle full of sediment (i.e. an old port), pour "over a candle". The candle just helps you see the sediment in the bottle neck better as it begins to slide towards the opening.
OK, now you have a wine without sediment in it. Why would you let it sit there? Isn't wine and air a bad combination? Well, yes and no. Yes, during the years of aging you don't want air getting to the wine. However, now that you're about to drink it, air getting across a good surface area of a wine can bring out its aromas.