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.