This is done ONLY prior to the first seasoning, or before starting from scratch if your seasoning gets abused beyond hope. I even do this for new "preseasoned" cookware. Lodge (the most well-known brand around today) uses a soy-based vegetable oil on its cookware, but I prefer to strip it all off and start fresh.
Start by washing in hot soapy water (this is the ONLY time you will EVER use soap on your cast iron), rinse it well, and put it upside down in the oven, set to 200 degrees F or less, to dry completely. If your pan is now a dull gray all over, you can move onto the actual seasoning process (below). If there are patches of rust or cooked-on gook of indeterminable origin, grab some steel wool or a wire brush. For really stubborn greasy residues, try covering them with this natural oven cleaner and let it do the work.
Seasoning Your Cast Iron
There are dozens of strongly held views on the "right" way to season cast iron, but they all boil down to this: Apply a very, very thin coating of an edible fat or oil (grass-fed lard, olive oil, or even duck fat) to all surfaces of the item, including the underside, handle, and sides of the pan. Wipe off any excess, then bake it in a moderate (300- to 350-degree F) oven for a few hours, allow it to cool, and repeat a few times until it starts to turn an even or speckled brown. It is simple to do it right, but you just have to be patient. Globbing on a thick coating and baking once will not achieve good seasoning, and doing so will leave you with a sticky, gooey, gloppy layer and you'll have to start over.
Stick to frying or cooking in oil and fat the first few times you use your cookware to keep the seasoning process going.
Caring for and Cleaning It
As you continue to use your cast iron, it will darken and become an even, shiny black, which means it's getting really well seasoned and naturally nonstick. Using a stainless steel spatula with a straight edge and curved corners as you cook will help polish the inside surface, making it even smoother and more nonstick.
Do not leave food, especially acidic foods like spaghetti sauce, in your cast iron for more than a short time after cooking. It will react with the iron, making it black and icky tasting, and ruin your carefully developed seasoning. It's actually a good idea to avoid cooking acidic foods in cast iron at all until you develop that nice shiny, black surface.
Cleaning cast iron can seem tricky, since you shouldn't use soap or detergents (or put it in the dishwasher), but here are a few tricks to make cleanup easier. Immediately after use, hold your pan under running hot water and give it a quick swish with a nylon or natural-fiber brush; don't use steel wool or metal scrubbies. Use a nylon or wooden scraper to dislodge small stuck-on bits. If there is lots of stuck-on food, sprinkle some salt (kosher salt works well because the grains are so large) on the pan then go at it again with your brush. You can also fill the pan with hot water and return it to the stove on low heat for a minute or two to loosen food bits, then repeat the hot-water-and-brushing treatment. Return your cleaned pan to the stove, turn on the burner, and allow it to dry completely. If there are any dull gray areas, coat the pan lightly with oil or fat before putting it away.
Store your pan uncovered in a dry place to prevent rust. I store mine upside down in my oven, which has a pilot light so it stays dry and faintly warm even in our humid summers—and I almost always remember to take it out before I turn the oven on to cook in it.