Pastoralist and agriculturalist societies

How Pastoralist and agriculturalist societies emerged? What factors aided the emergence of each, and how did these forms of productions affect the communities that developed these activities?