It's much like when you kill a snake. You can cut it's head completely off with an axe and the body will continue to writhe around for a few moments. It's just the nerve endings dying, you can be guaranteed that it feels no pain without a head.
This is true - a rattlesnake or snapping turtle can still bite you after its head is off. My dad used to have them bite a stick just so that they were less likely to accidentally bite a kid who happened to poke them after they were dead. Also, once he scared my momma nearly to death when she was frying up (dead and dressed) frog legs in the skillet - their muscles/nerves contracted and they twitched around in the skillet. She had the last laugh - he had to fry them up after that!