What social, economic, and political factors led to the need for the formation of labor unions?