.. and how do folks get them? I am amazed how motivating the prospect of getting a secret hat is. I wonder whether a similar incentive would work in a class room situation.
For the up-to-date list of known triggers for secret hats see ❄️ Winter Bash 2019 Hat list ❄️ on Meta.
I haven't read much about the entire hat hunting thing except for the official announcement. My understanding as to why there are secret hats is that there is a drop in the number of visits starting mid December till the beginning of January (it's evident from analytics data that mods have access to, but are not allowed to share the numbers), and hats serve the purpose of raising interest as an additional mean of [instant] gratification.
On top of that, secret hats provoke sites exploration and trying out various scenarios (triggers change every year for the majority of the secrets hats), so the site "exploits" users' curiosity in order to help its load balancers to sustain even population of users throughout the end of the year. And, of course, there is a game aspect in the form the natural habit of "wildcrafting" colorful toys for the avatars, which makes it a nice fit for the pre-holiday and X-mas time of the year.
As for using secret hats in the classroom, I think it depends on the age of the audience, and whether you need to motivate your students. Teenagers will probably like this idea as they usually have shorter attention span and are needed to be motivated to learn. So, such gaming variety is good for them and encourages not to be afraid to do research via trial-and-error. On the contrary, many university students would probably consider this a waste of time given they already narrowed down their field of study and want to pursue a certain career, but it really depends on how you organize it.
The most streamlined version of "secret hats" in education would probably be making purposely occasional mistakes, say, five times per seminar or lecture. The first student to notice and correct you gets a point. Just make sure not to forget to correct yourself after a minute or two so that the erroneous information isn't imprinted on the learners if nobody raised a hand to yell at you:) Points can later be converted into "hats", e.g. some trinkets, a beaker with your signature, privilege to work on an analytical device for extra hours, more freedom in choosing lab project, or even reduced number of tasks on the finals.
The whole idea of Winterbash is to round up the year and have some fun with hat hunting as you already note. Every year, there is a list of hats that are public knowledge to everyone; depending on the hat in question, people who hunt hats will get it as soon as they can. (Most hats are easier to get on a high-activity site like SO than on a relatively low one where even Nice Answer badges are somewhat rare like Chemistry.)
While there are hats whose triggers are purposely at some place in the future (see the hat(s) that can get awarded for participating on a site while it is the 20th somewhere in the world) to make sure that people remain interested in returning and don’t just (attempt to) collect them all on day one, this still doesn’t mean that everyone will keep a constant interest; some might just come on trigger day, participate briefly, and leave again.
That is where secret hats come in. To a first-timer, non-regular or person who avoids spoilers, these come as a pleasant surprise when you get the first. Of course that sparks competition, especially if you look at the leaderboards and see other people with hats not on the list. The intended outcome is for you to interact with the site trying out different triggers until you get the hat (and think you found out how it works).
Of course, others have done that too and that is where the Winderbash hat list post comes in. So if you want to shortcut your way into getting such a secret hat, others have probably done the work for you – or you can confirm if your guess was correct.