"If somebody you knew, whether they were a criminal or a window washer, constantly talked about "the rules", you would never want to hang out with this fuckin' nitwit, would you? You're washing the window and the fucker says, 'Rule #1. No streaks.' What an annoying dude. Get him away from me."
He's in a dangerous or uncomfortable situation with other people who are less experienced or trustworthy than him, and he wants to make some things clear. So he bluntly declares a numbered list of "rules" for the situation. Beginning, of course, with Rule Number One, and following it with Rule Number Two, and so forth. The implication of setting out these rules, and providing a semblance of structure by numbering them, is that they are resolute and unquestionable, and that breaking these rules will lead to dire consequences.
Another situation is conveying advice or admonishments, such as with the Mentor Archetype or Old Master. In this case the rules could be 'don't use the Dangerous Forbidden Technique' or 'always believe in yourself'. They are likely to include Rule Zero: "I'm always right."
One version of this trope became so popular that 90% of these will be Stock Shout-Outs to Fight Club — "Rule Number One of [X]: You do not talk about [X]" and/or "Rule Number One: [Y]. Rule Number Two: [Y]!"
There Are No Rules is a inversion, though that itself is sometimes called "Rule #1" nonetheless. This can then be subverted by having other rules follow which are actually restrictive.
The Thieves' Guild most often has each of its members adhere to certain numbered rules.
For the other Rule Number One, see Badass Grandpa.
Characters who live by The Rules are obviously on the Lawful side of Character Alignment, but there's nothing stopping them from being Lawful Good or Lawful Evil. In fact, expect the latter from the Obstructive Bureaucrat who can cite any Rule that justifies him/her not doing anything remotely reasonable or helpful.
In Dirk Gently's Holistic Detective Agency, Richard is breaking into his girlfriend's apartment when he receives a mysterious phone call describing "the rules of breaking into an apartment". Rule number one is "never answer the phone".
In Terry Pratchett's novel Thief of Time, Lu-Tze often reminds people about Rule One. Unfortunately for them, not everyone gets the message. Rule One is: "Never act incautiously when confronted by a little bald wrinkly smiling man!" Then there's Rule Nineteen, which is "Never forget Rule One, and ask yourself why it was invented in the first place."
Sharpe: Richard Sharpe has three rules for the men who serve under him: 1) Don't get drunk without permission. 2) Don't steal unless it is from the enemy or you are starving. 3) When it is time to fight, fight like bastards.
Vorkosigan Saga: Miles Vorkosigan's cousin Ivan, critiquing someone else's covert op that almost failed miserably: "You play games like that with the big boys, you'd better make damn sure you win, Miles says. Rule One. And there is no Rule Two."
In Alice in Wonderland, the King of Hearts reads out Rule Forty-two: "All persons more than a mile high to leave the court."
`Well, I sha'n't go, at any rate,' said Alice: `besides, that's not a regular rule: you invented it just now.'
`It's the oldest rule in the book,' said the King.
"I have two rules I follow," Saren explained. "The first is: never kill someone without a reason."
"And the second?" Anderson asked, suspicious.
"You can always find a reason to kill someone."
From The Middle of Nowhere, the second volume of David Gerrold's Star Wolf trilogy, trainee Apprentice Engineer Robert Gatineau discovers through multiple encounters that Rule #1 is "Whatever your superior officer says it is."
Ferengi are immensely fond of quoting Rules of Acquisition.
First Rule of Acquisition: Once you have their money, you never give it back.
33rd Rule of Acquisition: It never hurts to suck up to the boss.
45th Rule of Acquisition: Expand or die.
Unwritten Rule of Acquisition: When no appropriate rule applies, make one up.
Played with: the first Rule of Acquisition was presented as #162 - to create a demand for #1 through #161, and according to Quark's vision, they're only rules because the "Guidelines of Acquisition" doesn't have the same selling power.
A complete list of the rules (canon and non-canon) can be found here.
The Doctor: Do you fancy a quick trip around the twelve galaxies and then back to Perivale in time for tea? Ace: Ace! The Doctor: But, there are three rules. One: I'm in charge. Ace: Whatever you say, Professor. The Doctor: Two, I'm not the Professor, I'm the Doctor. Ace: Whatever you want. The Doctor: And the third... Well, I'll think up the third by the time we get back to Perivale.
In the Doctor Who New Adventures novel Set Piece Ace, seemingly left with no choice but to kill the Doctor to save the universe, flashes back to this conversation (and occasions when the Doctor had to make similar decisions) and decides that the third rule - her rule - is "No-one deserves to be sacrificed".
In the new series the following is said to companions, not that they ever listen:
The Doctor: Rule One: Don't wander off.
River Song's personal Rule One is, "The Doctor lies." And it turns out she was given that rule by the Doctor, along with Rule 7: "Never run when you're scared", Rule 27: "Never knowingly be serious" and Rule 408: "You should always waste time when you don't have any. Time is not the boss of you".
In "Human Nature", the Doctor leaves a set of 23 numbered rules for Martha to follow while he's transformed into a human and unaware of his true identity. In actuality, there were only about five instructions in the script (as Martha fast-fowards through most of them), and David Tennant hilariously ad-libbed dialogue for the skipped parts as seen here.
In the Virgin New Adventures novel, the list the Doctor gave Benny only has nine rules on it. The five Tennant actually gives are there, including the one about pears.
The Doctor's friend Iris Wildthyme has "Wildthyme's Law Rule Number One", which changesh every time to something pertinent to the current situation. Among other things, this rule has been "Grab the nearest bottle and hope for the best" and "A girl never knows when she may need to get the party started".
NCIS: Gibbs' various rules, cited by the characters throughout the show. A flashback revealed them to have been inspired by his future wife on the day they met. Kate and Ziva both requested that Gibbs write the rules down, only to be told that most of the rules are for day-to-day tasks. Rules in the forties are reserved for emergencies.
TWO rules are apparently number one (and two rule number threes), likely due to an oversight on the part of the writers, although later confirmed to have been intentional. This was lampshaded when the female version of Gibbs from CGIS told McGee HER rule number one and suggested he write it down. McGee replies that rule number one has been taken, twice. The other one was inherited from Mike Franks, Gibbs' boss when he first became an NCIS Agent. Mike Franks told Gibbs that he didn't need a list of rules; he only needed "Three Golden Rules". It has not been revealed which of the rules are Gibbs' and which are Franks, nor has the second Rule Number 2.
Robocop The Series had an episode featuring Murphy's old partner, a cop with a set of rules amounting to "no vigilantism". When said cop was brainwashed, Robo brought him back by making him say his rules. A minute later, he was killed with a rocket launcher.
Unproduced 2008 TV pilot Captain Cook's Extraordinary Atlas(available here) mentions three rules that were followed by Captain James Cook when exploring the more fantastic areas of the Earth, and that were supposed to be followed by subsequent "navigators".
In one of the most well-known Mash episodes ("Sometimes You Hear the Bullet" - the show's first Wham Episode and its Growing the Beard moment), Henry Blake tells Hawkeye:
Col. Blake: "All I know is what they taught me at command school. There are certain rules about a war. And rule number one is young men die. And rule number two is, doctors can't change rule number one."
In Red Dwarf, Kryten would often quote the Space Corps Directives, with a number each time. Rimmer would try to do the same, but get the numbers wrong; for example, quoting Directive 34124, which Kryten informed him was "No officer with false teeth should attempt oral sex in zero gravity."
Robot Club Leader: Gentlemen, welcome to Robot Club. The first rule of Robot Club is, you do not talk about about Robot Club. The second rule of Robot Club is, YOU DO NOT TALK ABOUT Ro? wait, I? got that wrong. [Unfolding a crumpled up piece of paper and pushing up his glasses] The second rule is, no smoking. Tim: Why aren't we allowed to smoke? Mike: Shh, we're not allowed to talk about it.
"Rule one - no pooftahs. Rule two, no member of the faculty is to maltreat the Abbos in any way whatsoever - if there's anybody watching. Rule three - no pooftahs. Rule four - I don't want to catch anyone not drinking in their room after lights out. Rule five - no pooftahs. Rule six - There Is No Rule Six! Rule seven - no pooftahs. That concludes the reading of the rules, Bruce."
In The Andy Griffith Show episode "The Big House", Barney Fife lays down the law for two new inmates at the jail:
Barney: "Now, here at the Rock we have two basic rules. Memorize them, so that you can say them in your sleep. The first rule is: Obey all rules. Secondly, do not write on the walls, as it takes a lot of work to erase writing off of walls."
The same gag appears in Porridge, only with the rules in the opposite order. According to Mr. Mackay, there are only two rules in Slade Prison. Rule number 1: Do not write on the walls. And rule number 2: Obey all the rules.
Harry taught Dexter a code to control his psychopathic tendencies. It had whole sections to make sure he only went after bad guys, but as he tells James Doakes toward the end of season 2 in response to the suggesting that he turn himself in, Rule Number One was always Don't Get Caught. According to Harry, that was the point of the whole endeavor, keeping Dexter alive; thus it's the first rule. Of course, no one wants anyone, even oneself, to know that he's turned his adopted son into a gory weapon of his own vigilantism. Not that it's cut-and-dried.
Ken: First, in battle yer either killin' or dyin'. So whatever you do, don't ever stop not dying. Second, we don't have time for stupid rules. So stop just standing around like a buncha idiots, and start beat'n the crap outta each other!
Genie: Rule number one: I can't kill anybody, so don't ask. Rule number two: I can't make anybody fall in love. Mwa! You little punim there. Rule number three: I can't bring people back from the dead. It's not a pretty picture. I don't like doing it!
On Family Guy, Peter recounts the story of his ancestor, Moses Griffin, who led the Hebrews out of Egypt. His Rule Number One: Shut the hell up.
Phil from Hercules has a whole list of rules for being a hero.
Phil: Rule number six: When rescuing a damsel, always handle with care.