Beer, like wine or coffee, is often used when a reduction over a long cooking time is called for but water would be sub-optimal.
I make chili a lot.
Water is not your friend there, especially if you incorporate a lot of elements that have water in them to begin with (undried/roasted tomatoes in particular).
Beer doesn't add the acidity that coffee does, but it is great for adding sugars and the maltier flavors.
The sugars aren't precisely 'sweeter' but rather add depth of flavor.
I'd be interested in the effect of carbonation on the cooking process, however since carbonation is supposedly lost faster at higher temperatures
I'd imagine it's less than expected.
Beer can be used to de-glaze and so on; its lower alcohol makes it much less reactive (than marsala or liquor) and the sugars make it as likely to glaze over.
Still it imparts some flavor depending on the context.
The type of beer you should use is largely up to you.
They differ greatly in flavor and composition.
For some suggestions on pairings check out this question.
Another consideration is to look into Cicerones; it's a certification people get where (more for large scale operations than restaurants or personal use), in addition to knowledge of processing and manufacturing, they are sommeliers of beer .
An additional consideration is how long the beer will be cooking down.
The longer the cook down, the more the flavors will be less distinct.
However, there are flavors that are frequently only found in beer; hoppiness, roasted malt, and (the effects of open fermentation with)
wild yeast can do amazing things in a dish.
Creating a side reduction minimizes the cook down and can preserve the flavors.
cooking.stackexchange.com/users/15/mfg
When a recipe includes wine as an ingredient, it's often also only specified whether the wine should be red or white, or occasionally what region the wine should be from, but seldom a particular wine from a particular winery.
This allows for as much variation in flavour as just saying "add beer".
On the other hand, I have seen quite a few Belgian recipes that specify a particular Kriek or Trappist.
So I think the flavour is definitely an important component.
As for chemical properties: the most obvious ones come from alcohol and acid, which @mfg talks about in this answer .
Carbonation is relevant mostly for baking I think, but I'll leave that for someone else to answer as I'm not really sure.
cooking.stackexchange.com/users/1163/Erik P.
Beer hasn't, historically, been given the same kind of attention as wine.
This is slowly changing, but I don't think beer will be treated the same for at least another couple of centuries.
So, many people tend to think that generally speaking, all beer is interchangeable (particularly in North America, where 'beer' usually means 'fizzy pale yellow liquid with no flavour'), thus the lack of specification when it comes to (most) recipes.
Bear in mind of course that you need to be careful with reduction, as (most) beers will become intensely bitter when reduced too far.
And generally speaking follow the same rules with beer as with wine:
darker for more intense/robust flavours, lighter for more delicate flavours.
Don't even get me started on the hideous apparition that is 'beer can chicken.'
If I wanted the taste of hot paint and aluminium I'd go lick the side of a house in the summer.
cooking.stackexchange.com/users/None/
Many of the recipes that I've seen using beer have relied on leavening properties (yeast), especially in the case of beer bread which is made without yeast or baking powder/soda.
I suspect that you could use alcohol-free beer in baking, although Erik P. makes the valid point that alcohol could have an effect on the outcome of the product (because of evaporation time/temperature, etc.).
In looking for substitutions, you need to consider why you're substituting.
If you want to avoid alcohol but still want to maintain the flavor, you could try an alcohol-free beer.
If you are okay with alcohol but not with the flavor, I would either go for a "watery, terrible, cheap domestic beer" or look for a recipe without beer.
With the former, odds are you won't taste it anyway (
not that you would want to), but you'll get the chemical reaction that you rightly suspect is at play.
Many sites have recommended pale ales and brown ales for cooking.
From http://www.globalgourmet.com/food/egg/egg0397/beertips.html#ixzz1OQxJr7dR
(I couldn't get the blockquote to work with the bullets):
Beer is by nature bitter.
It comesfrom the hops.
Malt adds a sweetflavor that counteracts andharmonizes with the bitterness.
Likewise, sweet foods profit from themarriage with the hops' bitter taste.
Use sugary vegetables like onions,carrots, corn, etc., and even addsome honey, molasses or sugar itself.
Caramelized onions are a classicexample of a sweet vegetable ideal with beer.
The bitter hop flavor also helpscounteract the richness of creamy,oil-based or cheese dishes, butflavor-wise, use it as sparingly asyou would a squeeze of lime or touchof vinegar.
Acidic foods like tomatoes, citrus fruits, vinegar and mustard cancompliment the sweet flavors, addingbalance and depth to the dish.
The yeast is perfectly suited to baking and battering.
Breads, fritters and pancakes profit from being made with very yeasty brews, which lighten the texture and make for tender, tasty crusts.
Beer tenderizes meats, making for good marinades.
Game marries well with beer, but so does chicken and fish.
For the newbie, robust dishes are a good way to start before experimenting with the subtleties beer can have on more refined flavorings.
The more the beer is cooked and reduced, the stronger its flavor will be.
If the dish requires long cooking and reduction, avoid using too strong a brew, lest you end up overdoing it.
Finally, sample some beers to understand the range of flavors.
If you can imagine a beer going well with a particular dish as a beverage, then it would likely make a good ingredient as well.
cooking.stackexchange.com/users/6303/christinealittlebit
Yeast, sugar, flavor...
What's not to like?
You do need to keep flavor in mind, however, especially when making beer bread.
cooking.stackexchange.com/users/218/Satanicpuppy
I've seen some recipies that call for a can of beer to be added, but never have I seen them specify a specific kind or brand. That leads me to believe its less for flavor and more for chemical reaction.  My question: why is no type or brand specified? Is it left to the cook to decide what type/flavor beer would be best, or is it simply a chemical process that any beer can facilitate? If the latter, are there other ingredients which could be safely substituted?
Some recipies call for beer to be added, but why?
cooking.stackexchange.com
<beer>
cooking.stackexchange.com/questions/13773
cooking.stackexchange.com/users/280/Nate
Beer is useful for long cooking and reduction as well as baking and battering due to the yeast. It has less acidity than some other liquids but can be used to deglaze while adding a sweet malty flavour. The choice of beer is up to you, but try one that would go well as an accompaniment to the dish when eating it. Beer is good for slow cooking and will bring in malty flavours. You can any use any beer you want.
Beer can be used for a reduction. It will add sugars and malt flavours. The yeast is also good for baking. You can use any beer you want, but if you would drink the beer with a dish then you could cook with it as well. Recipes normally just specify red or white wine.