What gives a "smoky" beer a smoked flavor? I recently started getting interested in smoked beers. Quite a few years back, Shiner had a seasonal called Smokehouse. I didn't care for it. However, I've recently been intrigued by varieties of smoked saisons, ipas and marzenbiers. What makes a beer smoky? Is the flavor created by casking, adding flavor or part of the brewing process?
To add a bit of detail to the existing answers, the primary method for adding a smoked flavor to beer is by using malts that have been dried over a smoky fire, rather than in a kiln which allows the malt to absorb compounds from the smoke that they then release into the beer during brewing.  Some of the oldest smoked beers still produced are German (Rauchbiers) and the malt is dried over beechwood.

Other woods can be used, and you can find malt smoked over oak, cherrywood, and any number of other species.  As mentioned in another answer, peat can be used as well and in fact is for Stone's Smoked Porter.   

Another method for adding a smoky flavor is to use liquid smoke extract. This is made my cooling and condensing smoke with water, and can be used instead of smoked malt.  I'm not aware of commercial brewers who use this method, but it's a way for home brewers who use malt extract instead of dried malt to add smokiness to their beers.