On Beta III, the Festival was a short period of lawlessness and debauchery that began at the red hour. The normally placid citizens of Beta III exploded into paroxysms of lust and destruction. Twelve planetary hours later, the Festival ended, and the people resumed their calm and tranquil state, oblivious to the destruction around them. (TOS: "The Return of the Archons")
No explanation for the Festival was provided within the context of the episode. In his novelization, author James Blish inserted dialog from the sociologistLindstrom who had a theory: in Landru's perfect civilization, births would outpace deaths, resulting in overpopulation. Festival provided a more or less random means of keeping the population level stable. This is certainly the sort of strategy a computer programmed to view individuals as cells in a body might construct.