Canning Randy is the second Halloween episode of How I Met Your Mother.
Ted opens the episode by giving a presentation about historical bridge collapses to his architecture class. As the camera pans down, he's shown wearing a hot-dog costume. He ends the lecture at that point and wishes his students a Happy Halloween, throwing candy to each of them. They joke around, and one of his students asks if Ted will come out with them. However, Ted declines, saying he has another party to attend.
Ted is now seen with the gang (minus Robin) at the Goliath National Bank Halloween office party. Ted (dressed as a hot-dog), Barney (dressed as Johnny Lawrence from The Karate Kid), Marshall (dressed as a bull) and Lily (dressed as a matador) are in attendance. Randy Wharmpess enters and greets the gang, offering them some of his home-brewed beer (it turns out in the end that Randy's beer become really famous in America in the future). He asks about Robin's whereabouts, and starts to shout and leave when he hears she's at a different party. However, he decides to stay when Lily says she might arrive later.
Randy asks if any of them are going to see the Halloween parade. Future Ted narrates that they were big fans of the parade. Not the official parade in The Village, but the one that takes place the next morning; The Annual Post-Halloween Walk of Shame parade.
Ted, Marshall and Barney all sit of the front steps of The apartment, drinking coffee, commenting on the different girls that walk by. Ted looks down the sidewalk, and sees Robin walking towards them, wearing a nurse costume. When she reaches the steps and sees the three men, she stops and swears.
Later in MacLaren's, the gang try to find out who Robin hooked up with Halloween night. Ted hopes Robin didn't hook up with another of her co-anchors, until Robin reminds him her co-anchor is Becky, a woman. Barney then hopes that Robin did hook up with her co-anchor.
Future Ted explains how Robin always tried to be an intelligent, hard-working professional, but Becky had a different philosophy, and recently starred in a boat commercial to promote her image. As a journalist, Robin believes that acting in a commercial is a bad decision and would stop people from taking her seriously, but is frustrated when her cameraman Mike loves Becky's commercial.
Later on, when Ted walks into work at GNB, Zoey and a group of protestors are standing outside the building protesting the tearing down of the Arcadian to make way for the new GNB headquarters. Zoey and Ted argue, and Ted tells Zoey she knows nothing about architecture and walks inside.
Future Ted explains that it was decisions like this that made GNB unpopular, so to increase their popularity each year they produced a "feel good" video to improve the bank's image. Barney, Randy and Arthur Hobbs all appear in the video, reinforcing that Goliath National Bank cares about its customers, the Earth, old people and high-yield off shore investments.
Barney tries to interview Marshall in his office for the video, but Marshall refuses. Randy enters the room, and Marshall asks why the Hermettson contracts never arrived at the downtown office. Randy thought Marshall wanted him to shred the documents, so he vows to fix the documents, taking Marshall's sticky-tape and runs from the room. Barney tells Marshall he should fire Randy for his incompetence, but Marshall says that that is exactly why he doesn't want to be in the video, because GNB doesn't actually care about people.
Marshall recounts a story where Arthur fired another employee because he wore the same color tie as him. Marshall explains he doesn't want to treat people like their disposable, and vows to Barney he will never fire anyone. Randy enters the room, showing that he's making progress on taping the shredding pieces together. To try and appease Marshall, he answers Marshall's phone for him, and inadvertently spills food on Marshall and knocks over different items on his desk.
Meanwhile, Lily is busy interrogating Robin, trying to discover who she slept with. Since Robin won't give Lily a name, she realizes it must be someone they know, otherwise Robin would have no problems giving her the person's name.
Ted is giving another lecture to his architecture students, and is shocked to find see Zoey in his class. As Ted pointed out to her, she didn't know anything about architecture, so she decided to join his class to learn more. In the process, she continually interrupts him, and reveals to the students that Ted is planning to destroy the Arcadian to make room for the new GNB headquarters.
Back at MacLaren's, Ted reveals to Lily and Robin how he lost the respect of his students. Lily offers some advice on how she deals with troublesome students in her kindergarten class. She simply flashes the lights and mimics a car alarm, and all her students stop and quiet down.
Barney and Marshall enter the bar, and Marshall explains how earlier at GNB, Randy entered with the completed Filbert contract. Marshall reminded him that he was supposed to be working on the Hermettson contract, so Randy shreds the Filbert contract. Marshall laments the loss of the contract, as he needed the Filbert contract. Fed up with Randy's incompetence, Marshall goes against his vow, and fires Randy.
At MacLaren's, Barney pops some champagne to celebrate Marshall "popping his cherry" and firing Randy. Upon hearing Randy's name, Lily jumps up, claiming to know the identity of the person Robin slept with on Halloween; Randy. She then explains what she thinks happened: Upset that Becky was receiving so much attention from her boat commercial, Robin went to the GNB party after the gang left, vulnerable and drunk. When Robin saw Randy, they went home together. Robin confirms Lily's suspicions, admitting that she slept with Randy.
Later that night, Marshall has a nightmare that Randy kills himself by jumping in his shredder because Marshall fired him. So, the next day he goes to his boss, Arthur Hobbs, and convinces him to rehire Randy.
Back in Ted's classroom, Zoey has turned all Ted's students against him by telling them about the argument she and Ted had earlier. He tries to calm them down by offering them each a mix CD, but they continue to shout at him. Remembering Lily's advice, and realizing he has nothing to lose, he starts flashing the lights and mimics a car alarm.
Later at MacLaren's, Ted tells Barney and Lily that, amazingly, it worked, Randy enters the bar, smiling, greeting the gang. Barney thinks the smile is because Randy killed Marshall, but Lily suspects it's because he slept with Robin on Halloween. However, Randy corrects her, explaining that he never slept with Robin. The reason he's smiling is because, with the severance check from getting fired, he can follow his passion and start his own brewery! Unfortunately, Marshall enters the bar and tells Randy he's no longer fired, causing Randy to break down in tears.
Later, Ted enters his classroom, only to realize no-one is there; Zoey has convinced all his students to protest against the Arcadian's destruction with her outside GNB.
In Marshall's office, Randy and Marshall are arguing over Randy's recent rehiring. Randy explains that he doesn't belong at GNB, that he should be a brewer. Marshall points out he can always quit and become a brewer, but if he does Randy won't receive the severance money he needs to start the brewery. Arthur enters, assuring Randy he'll never be fired again, and once he leaves, Marshall confirms that he'll never compromise his morals and fire anyone ever again. So, Randy tries to make Marshall fire him by messing up Marshall's desk and files and throwing drinks in his face. But no matter what he does, Marshall refuses to fire him.
Ted calls Lily for advice again on how to make his students like him again, but Lily says he should embrace their hatred, because behind their hatred lies fear, and he can use that fear to control them. Ted calls Lily a psychopath, and hangs up. However, he decides to take her advice anyway, and tells his students if they're not in class tomorrow, they'll fail the course.
Later that night at MacLaren's, Ted is telling Lily about what he said, when Robin enters. They confront her about her lie involving Randy, so she comes clean; she spent the day after Halloween starring in her own commercial, for adult diapers. Ted and Lily laugh and can't wait to see the ad, but Robin tells them they might not even use it, but Future Ted says that the ad ran for seven years.
Back at Marshall's office, Randy apologises for trashing the office and hands Marshall one of his homemade beers, saying how making beer had always been his dream. Randy explains how that might sound stupid, since Marshall has already reached his dream of being a corporate lawyer. Marshall scoffs, surprised that Randy thought being a big, corporate lawyer really was his dream. Randy offers to clean up the office, and walks out of the room. Marshall takes a sip of beer and stops Randy, telling him his beer is delicious and then fires him.
Afraid of failure, the next day Ted's entire class turns up to his lecture as Future Ted narrates how Randy took the severance money, started his brewery, and now sells Wharmpess beer in every bar in America. Proud of what he did, Marshall finally agrees to appear in GNB's feel good video, saying "I care about making dreams come true."