Many theories have been offered to explain large-scale flocking and roosting behaviour in birds. Ideas include:
• Heat conservation - but in many roosts the birds maintain a significant distance from each other, allowing most of the accrued heat to radiate away.
• Protection in numbers - but many roosts are extremely noisy, which would attract the attention of predators. Many species also perform elaborate mass-flight displays - also drawing attention to their presence.
• A new theory was raised by Ward and Sahavi in 1972 - in their paper 'The importance of certain assemblages of birds as information centres for food finding'. The team proposed that birds in large-scale roosts can pick up valuable information about the availability of local food sources etc by observing the behaviour of other birds. In other words they are 'reassured' if the flock is large, and stay in the area where food is plentiful.
This new theory also has hard-to-explain facets
“[…] there must be occasions when, perhaps for long periods, all the members of the population are perfectly capable of finding their food unaided, yet they converge regularly upon the roost, colony, or other information-centre.”
Note: The same puzzles apply to 'herding' in animals.