They have an extremely good sense of hearing.
For example, the hairy woodpecker and pileated woodpecker can actually hear those carpenter ant larvae and get right into a nest of them quite efficiently.
Woodpeckers also tap tree trunks to find the hollow places where insects might be.