Woodpecker has a thick skull and a small brain.
Knocks on wood are transferred evenly from the beak on the entire skull, whose thick walls mitigate them.
Small brain means that a small mass runs back and forth, which results in very small tremors of the brain that could not seriously affect the health of woodpecker.