Time Lords can tell when they're due to die soon. They can sense when the timelines are going to converge, and going to end in rebirth.

"It'll be a Sunday," the Doctor said. He was slumped in a chair, half-sleep, but Nardole could still hear the mumbling.

"What's Sunday?" asked Nardole. He looked up from his cleaning job on the ship.

"My death will be decided on a Sunday. If I make one choice, I will live another century. If I make another, my death is assured," said the Doctor. His eyes flutterred open, and he focused on Nardole. "Protect the humans."

"Bill? She's safe with me. Well, as safe as humans can be," said Nardole.

A grave expression filled his face. "No, not Bill."

Then he fell asleep again. When he woke up, there was no recollection of the conversation. It troubled Nardole.

Years later, the Doctor stared at the Cyberized body of Bill, and realized he could leave. If he walked away right now, he would survive. He could never look himself in the eye again, but this place was hopeless. There was no way to save Bill. Missy had betrayed him. Nardole...was being Nardole.

"What are you thinking about?" asked Bill. He could almost see her wide eyes beyond her metallic exterior.

"Death. Life. And letting go," said the Doctor.

"I miss Frozen. When it's all over, can we see it?," said Bill.

"Of course. Pick a day, and we'll go," the Doctor lied.

"Let's pick a Friday," said Bill, her voice filled with excitement.

And hearing that honest joy from Bill, even in this darkest day, made the Doctor decide. He would stay. The timelines converged, and then snapped to a point. He would die within the next few days.

"What's today, actually?" asked Bill.

"I'm positive it's a Sunday," said the Doctor.