Airplane bathroom:
- Why are there ashtrays in the bathrooms on nonsmoking flights?
Airplane bathroom:
Asked and answered on Aviation.SE.
Summary: They're required by US federal aviation regulations. The apparent rationale is: a desperate, or unscrupulous, smoker might (illegally) light a cigarette in the lavatory. If they do, it is good for there to be somewhere safe for them to put the cigarette butt. Otherwise, if they don't see anywhere else to put it, they might put it in the trash receptacle, which is full of combustible paper and could start a dangerous fire.
There is speculation that the 1973 crash of Varig Flight 820 may have been caused by just such a fire.
Having worked for a Government contractor, I can tell you first hand that it is very expensive to make a design change, even a trivial one like removing ashtrays that are no longer needed. I cannot tell you how many times I've seen piping being re-routed around obstructions that no longer exist. The reason was that the cost of reworking all of the drawings, re-engineering the design, and getting all necessary approvals costs far more than just continuing with the unnecessary work. Generally, material is far cheaper than labor.
The "just in case someone decides to smoke" explanation seems plausible, but sounds more like an afterthought to me. I think the likely reason, like most everything else, is money. The cost of installing an unnecessary ashtray in a new airplane is orders of magnitude cheaper than paying all of those people to remove it from the airplane's design. This does not even consider the cost incurred by the FAA to update all of their regulations.