The following contains spoilers for This Is Us, Season 6, Episode 17, "The Train," which aired Tuesday, May 17 on NBC.

For many seasons, This Is Us has been building towards the moment when the entire Pearson family gathers around Rebecca's deathbed. The end of the previous episode saw Kevin making the first call to put this event into action, bringing together several years worth of storylines. The episode maintains the timeline splicing that has helped define the series, as well as an eloquent metaphor for moving on to the afterlife to tell the story of Rebecca's death in an expectedly emotional episode.

The episode shockingly starts with not the Pearson family, but with a new family who gets into a car accident. One of the young boys in the backseat, Marcus, isn't wearing his seatbelt and is rushed to the hospital. His family is worried in the waiting room, and while getting some coffee, the boy's father runs into Jack. Jack is there right after the fire and their interaction takes place just before his death. The doctor who treated Jack is the doctor who helped save Marcus' life.

RELATED: This Is Us: Why Randall and Miguel's Special Bond Makes Total Sense

this is us kevin_1400x700

When Marcus grows up, he becomes a doctor with the goal of curing cancer. When his funding is shut down, he catches up with his siblings, who echo the advice Jack gave their father the night he and Jack met -- the Pearson family motto of turning lemons into lemonade. Eventually, Marcus goes on to make great strides in helping to create medicine to treat Alzheimers. This storyline ties into the episode's discussion about the dichotomy of life and death as well as exploring the impact the Pearson family has had on everyone they come in contact with.

Around the house, the family has come together, but Kate doesn't arrive with Phillip and her kids -- she'll be joining them later. The fact that they traveled separately had fans speculating for years that Rebecca had actually outlived Kate, though that was proven to be false in this episode. The family is all sort of in waiting for Rebecca's last moments, unsure of when it will happen. The waiting is very hard on Randall, and so Deja comforts him, and when she does, she admits to him that she is pregnant. This news finally brings a smile to his face, though it's wiped away not long after when the nurse announces that Rebecca doesn't have much more time, so they should start saying their goodbyes. Kate is on the plane when Randall and Kevin call to tell her Rebecca likely won't make it through the night.

RELATED: This Is Us Tragic Backstory for Phillip Proves It's Time to End the Show

this is us randall kevin rebecca_1400x700

The show cuts from the other storylines to use a metaphor to showcase Rebecca's final moments. It was previously explained that Rebecca had always loved the train, so in her final hours, the show dives into Rebecca's thoughts, processing her life and memories on a train. She sits alone, claiming she is waiting for someone to start with, but it isn't long until she sets out on her journey. William shows up to sit with her before he invites her to join him in the bar car. Traveling through the train is how the show represents Rebecca's journey onwards. While walking through the train, she sees her family who come to say goodbyes, and along the way William serves as her guide.

Beth is the first of the family to say goodbye, and she explains that she took a lot of inspiration about her own approach to motherhood from Rebecca. She promises to look after the family when Rebecca is gone -- especially Randall. After talking to Rebecca, Randall and Beth talk about Deja's pregnancy and Randall's plan to go in last with Kevin and stay until the end. While Randall and Beth talk, Kevin pulls out Rebecca's record collection and plays Joni Mitchell. This allows for family reminiscing before most of the family goes to bed leaving just Randall and Kevin. That night, Malik shows up to Deja's side, revealing that they got back together, and he is the father of her baby.

Next on the train, Rebecca sees Dr. K. He's tending the bar which is decorated with Pearson family paraphernalia. As they talk, Rebecca looks around the car to see Kevin and Randall sitting with the younger versions of themselves -- a glimpse into their lives all at once -- but she notices that Kate isn't there. Dr. K congratulates her on how she raised her kids, and gives her permission to leave them behind. He admits to her that she nearly died while giving birth, and he really believed she wasn't going to make it. He was proven wrong, and she made a beautiful life out of her survival. William takes her forward after she gives Dr. K a final thank you and farewell. She moves forward to hear Sophie and Toby's goodbye speeches, followed by Annie's heartfelt thank you.

RELATED: This is Us' Katoby Episode Doesn't Fix Their Season-Long Problem

this is us randall rebecca_1400x700

Randall and Kevin go to Rebecca's bedside after the rest of the family goes to sleep. They rehash family stories and remind the audience of previous episode storylines. They wonder if their chatter gets through to their mother, and on Rebecca's train, it is clear that it does in fact resonate with her. Their stories lead her on the train to Miguel who tells her that she is, and always has been, his favorite person. She doesn't linger with Miguel long and she and William continue on. When they get to the caboose, she refuses to go through because she's waiting for someone.

Rebecca survives the night and Kate arrives first thing in the morning to join her brothers at her mother's bedside. Kate gets to say her goodbyes. Hearing Kate's voice allows Rebecca to move into the caboose car as she was waiting for her daughter all night, refusing to leave without her. Randall struggles with what is the right thing to say, so he just tells her that he loves her and thanks her. Kevin goes next to tell her he loves her. In the caboose she can hear her children's goodbyes, but takes comfort from William's advice about enjoying the journey as he leaves her at the end of the train. Rebecca squeezes Randall's hand in life as she lays down to rest in the caboose of the train. She lays down next to Jack, reunited with her first husband, which ends the episode.

The final episode of This Is Us will air on Tuesday, May 24 at 9pm ET on NBC.