The festival takes place on the beach between 10am and 6pm on the 20th day of Summer. On the 19th, Rick will come to your farmhouse in the morning to ask what cow you'd like to enter. If you own a cow and want to enter, choose a cow and Rick will take it for the festival on the following day. Rick will not take a calf, sick or pregnant cows. If you do not own an adult cow, Rick will still encourage you to come watch the festival.
On the 20th, go to the beach and talk to Rick to start the judging of the contest. Your cow will be up against three other contestants. The higher the heart level your cow has, the better your chance of winning. A cow at 9-10 hearts will almost be guaranteed to win (although 9 hearts may still get you second place). Any placing besides first place counts as a loss. Nothing will happen if you lose.
If your cow places first, it's level will increase.