The woodpecker toy is made up of a pole with a sleeve around it. The hole in the sleeve is just a bit larger than the diameter of the pole. The sleeve is connected to the bird figure via a spring. Friction holds the sleeve (and woodpecker) in place initially. The beak striking the pole results in the sleeve sliding down the pole just a bit before it is once again jammed. The spring and rocking motion of the entire assembly allows the the sequence to rapidly repeat. It ends up being an effective simulation of a woodpecker's motion.
If you crave a more technical/mathematical description of the toy, check out this paper: Nonlinear Dynamics of the Woodpeck Toy.
Here is where you get your own wooden woodpecker toy for further experimentation (also known as 'play').