Group formation and the evolutionary pathway to complex sociality in birds