How Do Woodpeckers Know Where To Peck To Find Food and How Does Pecking Trees Help Find Insects?

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.