Obviously, the short-run benefits of smoking are far outweighed by the long and medium run detrimental effects, and this isn't an argument in favor of people smoking.
1) nicotine is a cognitive enhancer, giving short term improvements in attention and memory.
This has pretty clear benefits for programming. See sources/citations at end of comment for more information.
2) The nicotine addiction withdrawal cycle of leaving the building to smoke every x hours provides a relatively scheduled context shift. I've found this to have similar effects(albeit more mild) effects to timer based productivity techniques with timed periods of focused effort followed by breaks. I frequently have 'aha' moments in the elevator on the way down to smoke from my office after being stuck on a particular problem or bug coding.
See: NIH 1992 - http://www.ncbi.nlm.nih.gov/pubmed/1579636 " Abstract 1. Nicotine improves attention in a wide variety of tasks in healthy volunteers. 2. Nicotine improves immediate and longer term memory in healthy volunteers. 3. Nicotine improves attention in patients with probable Alzheimer's Disease. 4. While some of the memory effects of nicotine may be due to enhanced attention, others seem to be the result of improved consolidation as shown by post-trial dosing."
Cognitive Effects of Nicotine Amir H. Rezvani and Edward D. Levin (2001) http://directory.umm.ac.id/Data%20Elmu/jurnal/B/Biological%2...