Since man has learned to capture animals for breeding and for food, he has made it easier and more energy efficient to raise all kinds of farm animals in order to create a profit, secure stable food supply and ensure the health and reproductive cycles of all these animals.
At first he just placed sheeps , lambs, cows in an enclosed fenced area that is near a water resource. He would just drive the animals to different areas of pasture land for feeding. As demand and value for animal produce increase tremendously, he had to find ways to increase productivity at the same time ensuring the environment and the requirements for the animals are met and preserved.
Technology has helped the traditional farmer to have great quality yields of animal produce in all areas of production. From reducing the days cycle of chickens to 45 days, to artificial insemination of pigs, lambs, sheep and others plus the use of medicines to give anti biotics thereby reducing the mortality rates of the animals.
Here is a good article on farm animals.