The Spirit of the Hive: The Mechanisms of Social Evolution