Lily brings a goat home from school. Ted celebrates his 30th birthday. Barney and Robin deal with the repercussions from their night together. Barney hires Marshall to help him find a loophole in The Bro Code.
The episode begins with the aftermath of the events of Sandcastles in the Sand. Barney and Robin are in bed together. Robin proposes that they pretend their tryst never happened, and Barney agrees. However, Barney feels quite awkward and uncomfortable around Ted at MacLaren's later in the day. Hoping to find an excuse for his and Robin's actions, Barney seeks out Marshall to help him find a loophole in the Bro Code, a document very important to Barney's life as a bro. Allegedly written by Barnabas Stinson in the 18th century when Benjamin Franklin and George Washington were too busy to write it themselves, the Bro Code proves to be a very tight document that Ted has followed flawlessly and Barney fails in finding a loophole. Though she seems fine with it at first, Robin finds the secret even harder to keep than Barney and eventually admits to Ted that she and Barney slept together. That night, when Barney picks up Ted in a limo to take him to Ted's 30th birthday party, an outraged Ted yells at Barney, telling him how wrong it was to sleep with his best friend's ex-girlfriend. Ted ends his rant by telling Barney that he not only does not want to be bros anymore, but also does not want to be his friend anymore.
Meanwhile, Lily rescues a goat named Missy when a farmer brings it to her kindergarten class and horrifies her students by going into great detail about what will happen to Missy when she visits the butcher. Lily plans to give the goat away to animal control, but becomes attached to the goat while waiting for Ted to arrive at his birthday party. Future Ted reveals at the end of the episode, after hinting at the destruction the goat would do, that he had the story wrong: Everything involving the goat actually takes place during his 31st birthday, at which point — Future Ted also reveals — Robin is living in the apartment.
In Zip, Zip, Zip, Ted gives Barney his blessing to pursue Robin, before their relationship commences. Ted gets upset with Barney for hooking up with Robin after their relationship ends.
After Ted reveals to Barney that Robin told him about their hook-up, Ted makes a remark about Barney wanting to nail his mother. In Little Minnesota, Barney reveals that he kissed Ted's mom when he dropped her off at the airport, which he elaborates (and embellishes) upon in Home Wreckers, in which it is revealed that this happened immediately after the events in Brunch.
In the limo, when Ted derides Barney for sleeping with Robin, Ranjit yells at Barney in Persian. Ranjit was previously said to be from Bangladesh, but actor Marshall Manesh is from Iran, where Persian is spoken.
Lily asks if Barney is "all smooth down there", but in Columns she saw Barney naked when painting his portrait and so would already know the answer to that question.
While on the roof with the goat anticipating Ted's arrival at his party, Lily tells Barney that "Stella just arrived." However, Ted (as the narrator) later realizes that the events involving the goat took place a year later, in the episode The Leap, by which point he and Stella had broken up. In fact, Stella moved to California as described in the epilogue of As Fast As She Can, the episode immediately preceding The Leap. But it could be that only the goat related incidents were from his 31st birthday and not anything else mentioned. Because when Lily is talking to Robin about having sex with Barney, the goat is there, but the whole Robin/Barney sex thing happened around Ted's 30th birthday.
It is revealed that in The Bro Code, 'A mother of a Bro is off-limits', but Barney has admitted to kissing, and perhaps sleeping with Ted's mother, yet Barney does not acknowledge he has broken The Bro Code in this aspect.
It's revealed that Ted's birthday is April 25th, 1978.
The Bro Code is an actual book released as a tie-in for the show. Several of the quoted articles in the show are the same as in the book, although under different article numbers.
Curiously enough, according to Bro Code, Article 38, a bro should never punch another bro in the groin, "even in a fight to the death". Early in the episode, Marshall claims that Ted never broke the code. But Ted breaks the Bro Code by the end of the episode, when he punches Barney in the groin in the limo. Although Ted did punch Barney in the groin it can be assumed that Ted was able to do it because they were no longer bros and friends anymore. The fact that Barney gave Ted verbal permission to hit him "anywhere but the face" may also factor into Ted's possible exemption from the code.
In Barney's flashback to the writing of the Bro Code, the girl on past Barney's left is wearing a dress from the episode "Halloween" from the show Buffy the Vampire Slayer, which Alyson Hannigan also starred in.
This episode shares many similarities with Tick Tick Tick. Both episodes begin with Barney and Robin lying in bed together following on from a kiss at the end of the previous episode (Sandcastles in the Sand and Disaster Averted ). In both episodes they try to pretend it never happened but Barney is so nervous he almost slips up. Similarly in both episodes it is Barney who gets the rawer end of the deal. In this episode, Ted forgives Robin but refuses to forgive Barney, ending their friendship. In Tick Tick Tick, after agreeing to break up with their perspective partners so that they can be together, Barney breaks up with Nora but Robin stays with Kevin , leaving Barney heartbroken. Also the proceeding episodes' titles are similar: This episode is proceeded by Rebound Bro and Tick Tick Tick is proceeded by The Rebound Girl .