On Halloween night, 1998, at Cornell University, Tom Bailey, Jr. (Patrick Dempsey), in costume as Bill Clinton, slips into bed with his pre-arranged date, Monica. It turns out to be the wrong woman, Monica's roommate Hannah (Michelle Monaghan), and Tom likes her because she is so honest and does not fling herself at him. Ten years later, Hannah and Tom are best friends. Tom is very wealthy because of his creation of the "coffee collar" and gets a dime every time it is used. Tom is with a different girl every week, while Hannah focuses on her career in an art museum. He is very content with his life, suspecting that Hannah is too.After Tom takes Hannah to his father's (Sydney Pollack) sixth wedding, Hannah tells Tom she must go to Scotland for work. While she's gone, Tom discovers that without her, being with another woman week after week is not very fulfilling. He realizes that he loves Hannah and decides to tell her his feelings when she gets back. Upon returning, Hannah surprisingly announces she is engaged to a wealthy Scot named Colin (Kevin McKidd). Hannah asks Tom to be her maid of honor for her wedding. After discussing it with his friends, Tom decides to be her maid of honor, only to spend time with her and try to convince her she does not even know Colin, as well as making her realize that he loves her and she should be marrying him.After arriving in Scotland at Eilean Donan Castle for the wedding, Tom realizes he is running out of time to stop Hannah. He meets all of Colin's family and must perform in a variant of the Highland Games, in which the groom must compete to prove himself worthy of his bride. Tom is also in the competition with Colin but loses in the last round. Tom takes Hannah out for a walk, hoping to tell her how he feels. The other bridesmaids interrupt for Hannah's bachelorette party. On her Hen Night, Hannah parades around a pub and sells her kisses for change. As she goes around, Hannah then kisses Tom. Though it just started as a peck on the cheek, it turns into a passionate kiss.That night, Hannah confronts Tom to ask about the kiss. When she gets to his room, her drunk cousin is there, trying to have sex with him. Hannah leaves and Tom runs after her. He knocks on her door, pleading for her to let him in. She refuses and asks about the kiss. He tells her he knew he, not Colin, was the one for her. She refuses to say that she thinks so too and instead tells Tom that she still expects to marry Colin the next day. Tom cannot go through with watching Hannah and Colin get married so he decides to go home.When questioned about his sudden departure shortly before the wedding is to take place, Hannah informs Colin that Tom is just afraid of losing her. On the way home, Tom realizes that he must stop the wedding and goes back on horseback. Just when the priest asks for objections, Tom is sent flying off his horse and through the chapel doors. Seeing her best friend on the floor, Hannah rushes to him. As he struggles to stand up, he tells her that he loves her more than anything and that she should marry him. They then share a kiss. Hannah tells Colin that she is very sorry and that he is the perfect guy, just not the perfect guy for her. Colin's grandmother then tells Colin, in Scots, to "deck" Tom, which he does without hesitation.Hannah and Tom eventually get married. Melissa catches the bouquet and then links arms with Tom's dad, to which he says "Number 6?" and his lawyer says "7". Hannah and Tom go on their honeymoon. Tom turns on the light just to see if he has got the right girl and Hannah replies "You do". The two kiss and as Hannah turns off the light, Tom says "Oh, Monica" and Hannah replies "Oh, Bill."
Output: Question: Who does Hannah end up with by the end of the movie?, Answer: Tom