When you're cooking dairy-free, some substitutes are pretty obvious. Milk alternatives are on most supermarket shelves and work pretty well in most recipes. Butter, though, is an ingredient that can be tougher to substitute because different alternatives work better for different cooking applications. Here are some rules of thumb to use in adapting recipes for dairy-free cooking.
Dairy-free margarines are widely available, especially in health food stores and supermarkets that sell a large selection of "green" foods (Whole Foods, Trader Joe's, and national chains with large natural foods sections). Do check labels carefully, as most margarines do include some dairy. (Earth Balance and Willow Run are two brands that are, as of this writing, dairy-free.) These products work best as condiments, in small quantities for pan sautéing, and in baking recipes that specifically call for margarine or that use small quantities of butter.
Oil can generally be used interchangeably with butter in recipes where foods are pan-fried or sautéed. The right oil depends in part on the temperature of sautéeing and on whether butter is being used to add flavor. If you're going to be using a large quantity of fat over high heat, make sure to choose an oil with a high smoke point. Conversely, if you're browning a food to get a light coating and add flavor, consider a flavorful oil like olive, sesame, or peanut.
Oil can often be used in place of butter for baking, especially in recipes where butter was melted beforehand. In general, one cup of butter equals 3/4 cup of oil. You may need to add a bit more protein (in the form of an egg white, perhaps) to some baked goods.
While shortening and other vegetable fats that are solid at room temperature perhaps have a bad reputation because they're so high in saturated fat, they have two major culinary virtues that no other butter alternative can match. First, they are the best things on the market for making flaky baked goods like biscuits and pie crusts. Second, versions exist that are safe for people with both dairy and soy allergies -- an advantage over margarine for those with this difficult combination of allergies. Spectrum Organics makes palm oil shortening and coconut oil that are dairy-free and soy-free.
4. Rendered Animal Fats
Obviously not for vegetarians, but these fats are a potentially useful (and often overlooked) option for savory cooking. Bacon grease is a traditional cooking medium in Southern cooking and duck fat is known as "Gascony butter" for its succulent taste. Schmaltz -- chicken fat -- and lard are other common cooking fats. While bacon cookies are more and more popular (especially in cooking blogs), these fats are more often used for browning other meats or for giving color to vegetables before braising or using in soups. Storing in the freezer can help extend their useful life.