There are several different types of injuries that can be caused by head shots and fortunately due to the popularity of boxing and prevalance of data on car crashes, we have a lot of information regarding what happens during the assault and afterwards.
A short article on how the brain hurts here.
Video of coup/contra coup injury here. It shows how the brain literally rocks back and forth inside the skull creating bruising. Typically this is shown front to back as that's how it happens most often during car accidents but keep in mind that anytime the brain rocks from one side to the other you can get this type of injury.
Compilation of Muay Thai head shot knockouts here. Notice the reactions of the receiver immediately following contact.
If you watch this video here though, you'll notice that not just any head shot results in a knockout. That's because the body shuts down when the brain does. If the blow is absorbed by the skull then no brain trauma and no knockout.
But if you really want to be certain of a knockout, watch this guy here. Soft hand blows such as a cupped palm or knife hand are significantly safer to use by the attacker and are far more likely to result in a coup/contra coup injury.
Information dealing with after-effects here.