Peter Klaven (Paul Rudd), a real estate agent, proposes to his girlfriend Zooey Rice (Rashida Jones); both happily become engaged. The conflict is that Peter seem to not have any close friends to share the good news with: only family and superficial (mainly female) acquaintances. After overhearing Zooey's female friends voicing their concerns over his lack of close male friends, Peter realizes his abnormality and decides that he needs to find male friends in order to have a best man for the upcoming wedding.Peter turns to his gay younger brother, Robbie (Andy Samberg), for advice on dealing with men. He makes a series of overtures toward various men, including Barry (Jon Favreau), the husband of Zooey's friend Denise. When Peter inadvertently projectile-vomits on Barry after winning a beer-drinking contest, he is kicked out of Barry's house.Feeling rejected, Peter is about to give up, when during an open house at Lou Ferrigno's mansion which Peter is trying to sell, he meets Sydney Fife (Jason Segel), an investor who is attending the showing simply to pick up divorced women and take advantage of the free food. The two quickly become friends, especially bonding over their mutual adoration of the progressive rock band Rush. Peter introduces Sydney to Zooey at their engagement party, but the meeting takes an unfortunate turn when a nervous Sydney makes a very awkward toast.The next night, Peter agrees to attend a Rush concert with Sydney, on the condition that he can bring Zooey. During the concert, Zooey is left feeling ignored by Peter and Sydney. The next day, while shopping for tuxedos, Sydney asks Peter why he is marrying Zooey, and also asks for an $8,000 loan. After some thought, Peter decides to lend Sydney the money, and later grants him the honor of being best man at his wedding. Zooey, meanwhile, has become suspicious of Sydney. Peter tells Zooey that he lent Sydney money and asks her if she knows why they are getting married, since he had no answer to Sydney's question. Hurt and angry, Zooey leaves.Peter leaves for work the next morning only to discover that Sydney has used the $8,000 loan to purchase several ridiculous billboard advertisements promoting Peter's real estate business (using pictures of Peter he took of him on his iPhone). Still upset over his fight with Zooey, Peter confronts Sydney and decides to end their friendship. Peter then patches things up with Zooey, explaining to her that while he is nervous, he is ready to get married. While Zooey and Peter prepare for the wedding, Sydney finds himself alone and desperate to hang with someone.At work, Peter discovers that Sydney's billboard advertising campaign was successful. Feeling encouraged, Peter finally stands up to his insufferable colleague, Tevin Downey (Rob Huebel), who had been badgering Peter for half the selling rights to the lucrative Ferrigno property. When Tevin makes one final attempt to get a piece of the Ferrigno listing, Peter slaps him across his face and tells him to stay away from it.Peter feels bad about fighting with Sydney but does not re-invite him to the wedding. Instead, he assembles an array of random groomsmen that includes Robbie, father Oswald (J. K. Simmons), and Ferrigno. Before the wedding, Zooey sees Peter looking forlorn, clearly missing his friend Sydney. She calls and invites Sydney, who is, unbeknownst to them, already en route to the wedding. Just before the vows are to be taken, Sydney makes a dramatic entrance via moped. He informs Peter and Zooey that he is, in fact, a successful investor and returns the money he borrowed from Peter, stating that the billboards were the couple's wedding present. Peter and Zooey declare their love to each other, Sydney assumes the role of best man, and the wedding commences.As the end credits begin to roll, we see the wedding reception, where Peter and Sydney join the hired band (played by OK Go) in a rendition of the Rush song "Limelight" pulling Zooey on stage to join them. After the song ends, Sydney attempts to toast the newlyweds and Peter runs to frantically stop him as the screen cuts out (still remembering Sydney's ill-advised toast at the engagement dinner.)
Output: Question: What is the name of Peter's gay brother?, Answer: Robbie