Just as with civilian flights, ashtrays on an aircraft make little sense. According to both civilian and military guidelines, smoking is forbidden while the aircraft is in flight. The no-smoking signs are a constant sting to every smoker with the urge to light up.
And yet...there are ashtrays on aircraft.
In 1990, the U.S. banned smoking on all flights. In 2000, international airlines followed suit. But before then, smoking was allowed on planes. Even in the military, older Blackhawks were outfitted with ashtrays that required cleaning before each and every flight. John F. Kennedy's Marine One had been made with several "smoking pits."
JFK loved his cigars.
Federal Aviation Administration (FAA) guidelines were changed after the crashes of Varig Flight 820 and Air Canada Flight 797 were believed to have each been caused by smoking passengers — killing 123 and 23 people respectively.
New rules were enforced, but aircraft models were still required to have ashtrays installed...just not used.
However, if someone does light up, risking a $100k fine and the lives of everyone on-board, the flight attendants need a place to dispose of the cigarette butt. The trash bins are filled mostly with paper waste, so that'd be a terrible (read: flammable) idea.
Don't try it. Even if you tamper with the large smoke detector, there are more hidden through out the lavatory.
The FAA doesn't have much jurisdiction over the U.S. military. Military operations are exempt from FAA guidelines but as a show of good faith while flying in U.S. National Airspace they follow them willingly.
Even down to the size of the UH-60 Blackhawk, an ashtray is still installed to adhere to FAA guidelines. Military helicopters still treat the cigarette butt as foreign object debris and that needs to be disposed of properly so as not to damage the aircraft.