The ending to 'How I Met Your Mother' has been nine years in the making, and in a special one-hour episode, the five original characters received a send-off which shocked, produced tear-jerking moments and answered some hotly anticipated questions.

The cast of 'HIMYM' said farewell on Monday night's final episode

The stories of Marshall (Jason Segel), Lily (Alyson Hannigan), Robin (Cobie Smulders), Barney (Neil Patrick Harris) and Ted (Josh Radnor) were told from present day until 2030, which is when Ted began this tale in the show's opening episode.

The first big surprise had nothing to do with Ted and The Mother, but Barney and Robin as they revealed their marriage ended in a divorce three years later. Robin's busy schedule as a TV reporter leads to the crumbling of their marriage, and two years after that Barney impregnates a women he met on a one nigh-stand.

But having the child, which is a daughter, is the best thing that could have happened to Barney as he is forced to re-access his life and finally begins to grow up.

How I Met Your Mother
Radnor, who plays Ted, finally unveiled the truth about The Mother

Following on from Ted meeting The Mother (Cristin Milioti) at Barney and Robin's wedding, he decides not to move to Chicago, but the pair don't immediately get married because "I want to fit in my dress," she says, thus revealing a pregnancy. They tie the knot five years, and a second child, later.

Marshall, who gave up a position as a judge so Lily could take her dream job in Rome, returns to Law an unhappy man, but is later given another judgeship role in Queens and eventually runs for State Supreme Court justice. They have three children together.

But as predicted weeks ago The Mother, whose name is Tracy McConnell, fell ill and died of an unspecified condition, then six years later Ted retells the story to his children in 2030.

"And that, kids, is how I met your mother," the future Ted says to them.

His daughter replies, "Is that it? I don't but it", in a scene which was shot in 2006. "You made us sit down and listen to the story about how you met mom? But mom is hardly in the story. No, this is a story about how you're totally in love with Aunt Robin, and you're thinking about asking her out and you want to know if we're OK with it."

MORE: Watch the cast of 'HIMYM' arrive for an appearance on Letterman's 'Late-Show'

More: The 'How I Met Your Mother' makers recently had to apologise for racial storyline

After nine years of eager anticipation, Ted does ask Robin out and they end up together happily ever after.

Smulders, who played Robin, ended the series by going out with Ted