Rule #1 is to never use a wine you would not drink! A wine's flavor will be present in any dish it is used for, so if you think you can help out your recipe with inferior wine, think again. I typically drink while I cook, so the wine is there when I need it. I would not suggest using Chateau Mouton Rothschild for cooking, but rather wines that you enjoy in a modest price range. Never use anything labelled "cooking wine". This is a cheap wine with additional sodium, being sold for more than it could fetch as a normal wine. If you don't drink it, don't use it.
There are three main purposes for wine in cooking. The first is for marinating. Many meats, especially tougher ones, taste and chew better when they are marinated. A wine can help break down muscle tissue and tendons, making a tender, soft, and tasty cut of meat. During the breakdown, blood and other flavor will seep out of the meat into the marinade, making for a tasty braising liquid.
The second purpose of wine is that same braising or cooking liquid. A wine will jump up the flavor to any sauce, stew, or braising liquid when added. Alcohol, sulfites, and water evaporate from the wine, leaving behind the concentrated flavor of the grape juice. These complex flavors, along with the natural sugars will enhance your meal.
The third purpose, and perhaps the most fun, is finishing. This is when you close the deal and give your meal the finishing touch of flavor, and sometimes flame, that it needs. A fortified wine, such as Port, Marsala, or Sherry, will enflame a dish, and give it a carmelized crust. You will also be giving it a desired flavor profile such as caramel and sweet cherry from Port, nuts from Sherry, or maple and licorice from Marsala. Finishing a dish can also mean deglazing a pan to create a sauce. You will pour wine into the just used pan on low temperature, hoping to get all the flavor crusties to mix and meld with the liquid. The liquid will reduce, leaving behind an extremely concentrated and tasty sauce to accompany your meal.
Make sure that you always pair the proper wine with your dish. If you're goal is to prepare a pepper crusted skirt steak, marinate it in Syrah/Shiraz. If you are making a lemon caper sauce for chicken, use Pinot Grigio. A butter sauce will be optimal with an oaked Chardonnay. The list goes on and on. If you have questions about these, leave your comment or ask @WCWineGuy on Twitter.
(image courtesy of flickr)