Yes, hats are fun!
People are actively trying to find the triggers for secret hats in the winter bash chat. Triggers that have been confirmed by staff are posted in spoiler tags here: Winter / Summer Bash 2022 Hat List ☃️ 🏖️
I don't think there's a way to find out which hats you got in previous years.
There is a small downside to hats: namely people performing actions on the site that they otherwise wouldn't in order to obtain these precious hats. E.g. voting on posts they haven't read, performing useless edits or rushing through review queues without a discerning eye.
A very prominent member of the hat community got his review privileges suspended for 'botting' review queues. To a hardcore hatter, such a suspension can be crucifying because it prevents you from getting certain hats and thus ruins your chances at topping the leaderboard.