Smoking on most domestic U.S. flights was banned in February of 1990, though individual airlines began banning smoking in the '80s. Ten years later, smoking was banned on all flights between the U.S. and foreign destinations. Yet, get on any flight in the U.S. and you'll find an ashtray in the bathroom.
Flight attendants make it very clear before takeoff, you can't sneak a quick smoke in the loo. You can't smoke anywhere. So, why do airplanes, including newly manufactured ones, have ashtrays?
Planes are actually required to have them. The US Code Of Federal Regulation for Airworthiness states, "Regardless of whether smoking is allowed in any other part of the airplane, lavatories must have self-contained, removable ashtrays located conspicuously on or near the entry side of each lavatory door."