Hello, welcome to the lounge!
To answer some of your questions: Wear your hat in a way that you feel it suits your own "look".
As to when to remove your hat. I would think a store is acceptable to leaving it on, I do when I am in a retail store. Places to remove a hat= Church, Government Office, your place of employment and it's office as well. Any "formal" dinning settings, places you would eat that are formal. Houses, if you are going into someone else's home, you would remove the hat to show respect. You also remove the hat at any time you are being presented to anyone that you want to show respect towards. Hats come off in a theater, unless you have a private seating booth all to yourself, and even then you more than likely would remove it. A general rule I use, if you wish to show any display of respect for another person or place, take the hat off, and shake their hand when being introduced.
I am sure others may add to this. I wear my hat when I am sure at times others may have already removed theirs, but that is just me.