I am happy to report that the pendulum seems to be reversing ever so slightly and men are beginning to wear real hats again. Not those unsightly baseball caps with plastic adjusters on the back, but actual fedoras and Cokes, like the ones keeping the sun out of the eyes of the fellows on the left. If only the airlines would give us a place to stow them during flight where they wouldn't be crushed by the next passenger's souvenirs, hat wearing might really take off.
In the past, men usually just held on to their hat or placed it on the back of their chair when there was no obvious place to store it. But I can state from experience that a tray table will not go down if there is a trilby on my lap.
Indoors, a hat is removed most of the time. The exceptions to the indoor hat removal rule are in a public place such as an air terminal or post office, or in the entrance halls and corridors of office buildings and hotels. The rules for elevators are complex but they can be summarized as bare headed is always correct. Emily Post does make an exception in a crowded elevator when there is no place to hold a hat - perhaps we could extend the exception to airplanes.
Outdoors, a man removes his hat while talking or being introduced to someone, during his national anthem or while his national flag is passing, and at a funeral.
We report these rules for your own safety. Inappropriately leaving your hat on your head was traditionally interpreted as a sign of contempt. Neil Steinberg writes in Hatless Jack that in living memory men have been killed for leaving their hat on while the American flag passed by on parade. And that would further reduce the ranks of hat-wearing men.