Why do animals form social hierarchies within their populations?