It’s amazing what you can achieve when you all work together. Check this stunning video of legionary ants building an ant ladder to raid a wasps nest.
The ants (also known as army ants or marabunta) work together in a kind of swarm intelligence and collective computation to link together to build the ladder / bridge.
When this type of attack happens, the wasps usually escape and the ants do not leave until they’ve completely looted the honeycomb, carrying pupae, larvae, and eggs, as well as any adults who did not manage to escape.
Its not known for certain why the shape of the bridge is so elaborate. It may be merely a failure mode that happened when they decided to follow & build the bridge (premature optimization gone wrong). Or that there was something in the ceiling affecting the trail pheromones. But biologists have pointed out something more fundamental. Many species ants have a hard time walking upside down. For ants it is more effective to follow the trail over a bridge that goes down and then up than in an inverted upside down walk.
Gravity may also play a part. They perhaps started as a straight path and started adding ants as gravity pulled the whole bunch down, so the bridge doesn’t end up breaking due to linear tension. So the first minutes they built the bottom part (looks less vertical) and added on the extremes on necessity.
Bridge formation could also more be more effective for looting and carrying loads if it provides separate lanes that allow for more efficient traveling in either direction, eliminating congestion. Studies show that ants partly optimise traffic flow. Ants headed back to the colony loaded up with loot use center lanes, while outbands ants use the edges. Ants are also sensitive to gaps and when other ants trample over their heads, so they start to follow other rules.
If you want to learn more about how army ants follow simple rules to build bridges and how they solve the trade-offs associated with it, read it here: https://quantamagazine.org/the-simple-algorithm-that-ants-use-to-build-bridges-20180226/
Source: This remarkable video was posted by Twitter user Francisco Boni.