Basically it is when you say two things that follow a pattern, then the third one is unexpected and different to the pattern that has been set. If the third item said is the opposite of the pattern set, this can increase the humour.
It is the rule of three, because saying two items that follow a pattern, creates the expectation that the third item said will also follow a pattern. So when the third item said breaks the pattern or is the opposite of the pattern, it creates the element of unexpectedness, which creates humour.
If only one item was said, it would not be enough to create a pattern. And if three items are said that follow a pattern, and the fourth item was unexpected, it may still work, but it takes too much time and effort to set it up. The person having to listen to you go through the list of four items might lose interest or feel like you are reading out a cooking recipe with the list of items.
The rule of three, as in two items that follow a pattern, then a third item that is unexpected and breaks that pattern; is a tried and tested method used by plenty of comedians throughout the years. As it has worked for all them, there is no point changing it as it clearly works.
Examples of using the rule of 3:
“My fashion sense was inspired by Eminem, Ludacris, and Mickey Mouse.”
“Waking up early is crucial to success. Waking up early allowed me to exercise early, get dressed for work, and not miss my morning cartoon shows.”
“I could not help but admire him. He was courageous, honest, and knew how to make a strawberry cheesecake.”
“I have big plans for my future. I want to have a solid career, buy a nice car, and own a penguin.”
The rule of three applies the principle of using the unexpected to create humour.