Just like with the farm crops, your livestock and poultry animals have rank levels attached to them. Any new animal you purchase from Popuri or Rick will start out at level 1. To increase an animal's level you will have to win the animal's assigned contest.
The day before the competition, Popuri or Rick will stop by your house and allow you to select an animal to enter into the contest. The animal can't be sick or pregnant. If it's a sheep festival then the sheep also has to have it's wool intact. After you select the animal you wish to enter it will be temporarily removed from your farm.
On the day of the competition go to the Beach to begin the contest. If you win against the other 3 contestants then you will increase the animal's level. If you come in 2nd or 3rd place, you won't level up at all.
In order to win the competitions your selected animal must have 9 or 10 hearts. You can increase the number of hearts an animal has with daily interaction.
After the contest is over your animal will be returned to you. If it has won then the animal's level will increase by 1. At this point your champion animal can become a breeder to produce more level X animals.
Unfortunately you can't enter the same animal the next year and have it level up again (except for sheep, which seems to work in the Japanese version). If you have a level 2 cow you'll have to enter the animal's offspring in order to receive a level 3 cow. You can't skip levels either! The highest level animal you can have is level 100.