Smoking was cool. Imagine James Dean and the Marlboro Man.
Partly because smoking enables a number of behaviors that support being perceived as "cool" - i.e. as unflappable, reserved, competent, etc.
Nicotine has a calming effect. The act of smoking provides a number of excuses to pause conversation: taking a puff and exhaling, taking out a cigarette and lighting it, stubbing one out. That gives the smoker time to think of a particularly witty comment or retort, so smoking is a way to cover up momentary confusion or upset. Cigarettes in particular provide fodder for introductions and starting conversations, such as offering or asking for a cigarette or a light. They're an excuse to join a group or leave one ("I'm just stepping out for a smoke").
It's a pity smoking is so toxic and otherwise undesirable (stains, odor, etc), because it's tremendously useful, socially. Unlike "social" media, which has profoundly antisocial effects.
 And even more so for cigars and pipes, with their even more elaborate preparation rituals.