Researchers don't know how they do it, but the birds are very efficient at it.
An unnecessarily drawn-out analysis of bird flight for animation
Thousands of starlings fly together to make an enormous bird
A BIRD'S FLIGHT
What Is A Group Of Birds Flying Together Called? - Fauna Advice
Birds of a feather … track seven neighbors to flock together
A biologist explains the science of murmurations - Big Think
How do birds that fly in a flock know which direction to go? - Quora
Why Do Flocks of Birds Swoop and Swirl Together in the Sky?
Through Hawks' Eyes: Synthetically Reconstructing the Visual Field
Nature curiosity: Why do some birds fly in a V formation?