Many unrelated species of birds have a habit of pumping (or wagging) their tails. They are mostly open-country birds like phoebes, pipits, Palm Warbler, Spotted Sandpiper, and others. Many hypotheses have been suggested to explain why the birds do it, but it was only in the last few years that research provided an answer.
In 2011, biologist Gregory Avellis watched Black Phoebes in California and found that phoebes pump their tails regularly all day long, and the rate of pumping does not vary much no matter what the birds are doing. However, playing a recording of a Cooper’s Hawk (suggesting that a dangerous predator was nearby) caused the phoebes to pump their tails three times as much.