There are many reasons why someone might want to substitute alcohol in a recipe: while the one that comes to mind immediately for me is religious dietary restrictions, it may be as simple as not wanting alcohol in a dish which will be served to children.
How, though, do you know what to substitute, particularly if you, like me, do not consume alcohol, and so do not have an idea of what flavors you are looking for?
First of all, it's important to know what alcohol brings to the table. Wines, liquors, cordials, etc, have a very concentrated version of the flavors of the original ingredients. This is similar to why we use extracts, such as vanilla extract, since alcohol can be used to pull the essence of flavors out and store them in a non-degrading state(and also why some people make their own home-made extracts using good-quality vodka, rather then the generic alcohol used by companies, but that would be an entirely different post). In addition to this, aged alcohols like brandies can add a certain smoky flavor picked up from their time spent in wood casks. Beer adds earthy malt and hops flavors, in addition to sometimes contributing additional yeast to batters and baked goods.
There is also the way alcohol interacts on a chemical level with other ingredients which needs to be taken into consideration. Some fruit, particularly berries(including tomatoes!) have flavor compounds which are only activated by contact with alcohol. Unfortunate for those who don't use it, but it explains the number of tomato sauce recipes livened up by a shot of flavorless vodka. It can be used to help break down meat fiber in marinades. Wine or kirsch helps the cheese in fondue to avoid clumping by breaking long protein chains, and lowering the boiling point of the cheese, while when added to frozen deserts, it lowers the freeze point, making it easier to make fine, even crystals. Alcohol can also be added to pie crust to produce a tender, more flaky crust, since it doesn't cause gluten development the way water does.
Since nothing can be done in most cases to imitate the chemical affects of alcohol in a dish, it is flavor considerations that seem the most important. First, get an idea of what the original ingredients of the alcohol in question are. Lists like the links below are an excellent resource. Personally, I find it rather useless to try to substitute something else for an ingredient like vodka, which I have been told is odorless and flavorless, and often omit it instead, if it will not damage the liquid levels of the food.
Beverages made of fruit (wine, apple brandy, etc) have their own set of challenges. During the process of producing alcohol, most of the sugars in the juice are used up, making wine considerably less sweet then grape juice. There are two possible solutions to this: The first is alcohol free wines, such as fre, which uses centrifugal force and nitrogen to separate the flavors and nuances of wine from the alcohol, rendering a less then .5% alcohol product, safe to consume even during pregnancy. The other option, my MIL's faithful standby, is the dry flavors contributed by cranberry juice. I will also sometimes use the Mexican soda Sangria in sweet dishes or fondue.
Rum is easier, since as a product of sugar cane, it remains fairly sweet. My personal favorite would be to use Malta India, usually available at your local Latin market. Due to it's status as "young beer", i.e. malty, but unfermented, malta is also an excellent choice for a beer substitute in many cases, although sweeter. A similar substitution would be Agave Nectar from the health food store for tequila(although, again, much sweeter).
When all else fails, overlooked sometimes is using a good homemade stock as a substitute, especially if low in salt. I could rant at great length about the great flavors homemade stock brings to the table, not to mention its historical precedence as substitute of choice for savory dishes.
An Excellent Substitution Chart from Gourmet Sleuth
Another challenge for many is to find something special-occasion to serve non-drinkers as a beverage. Next week...what your tea-totaling great grandmother drank.