New research shows that the most effective teams don’t choose between hierarchy and flatness but rather shift between them, adapting to the demands of the current task.