Let’s time-travel back to physics class: Static electricity happens when a surface receives extra electrons, which are negatively charged. So when certain materials rub against each other (like a knit hat against your hair), these negative charges hop onto the hair and start to build up. Objects with the same charge repel each other (think of magnets), which is the reason why your hair stands on end—each strand is negatively charged, so they want to get as far away from each other as possible.
It tends to happen during colder months, since dry, wintry conditions can exacerbate the static. “Electric charges don’t flow through water, so atmospheres without any humidity will result in much more hair static,” says hairstylist Miko Branch, co-founder of hair care brand Miss Jessie’s. “Dry, damaged hair is more prone to static, as it lacks the moisture to repel electric charges.”
Add some friction to an already dry environment (hats and scarves, vigorous brushing, towel-drying, etc.), and you can easily find yourself in a hair-raising situation.