Scenario: it's a hot summer day. You're outside hanging with friends trying to find something to do. One of them suggests going to get ice cream; you fall in love with this idea immediately. What could be better than ice cream on a day when the sun's blaring down at you? The first bite. A smile comes over you as you feel the cool sensation. Another bite. Then another. Then you get slapped in the face with a brain freeze. What just happened?
A brain freeze, also referred to as an ice cream headache, occurs when a cold substance being consumed quickly comes in contact with the roof of your mouth. The roof of your mouth is the hard palate, and behind that is the sphenopalatine nerve. When the nerve detects a fast drop in temperature it rapidly constricts (shrinks) and dilates (expands) blood vessels in the head to warm the area up. This sudden surge of blood to the area is what causes the headache which usually lasts from 30 seconds to a minute.
If you find yourself getting brain freezes then you should eat slower. The rapid intake of cold food or drink is constantly cooling the roof of your mouth with no time for it to reheat between bites. Once it gets too cold the nerves take over and you're hit with the headache.
For the fastest relief you should press your warm tongue to the roof of your mouth. This will help raise the temperature back up to comfortable level.