Nietzsche once wrote that if somebody has a why to live, they can bear almost any how. If somebody has something to aim towards, or someone to get back to, they can endure pretty much anything the world will throw at them. You have to have a reason to carry on.
But the idea is much older than Nietzsche. So much of ancient Greek philosophy can be summed up in two questions: where do I want to get to? And how can I get there? But the various philosophers had different answers to those questions. For Aristotle, we should aim at flourishing, and rationality was how we got there. For Plato, we should aim at an abstracted world of perfect purity, and we should use philosophy and dialectic to get there.
But of course, Nietzsche is different. For Nietzsche, and the existentialists that came after, we do not find or get handed a purpose. We have to create it. We have to invent a why. We have to build a reason to carry on.
One of my favourite moments from The Simpsons is when Homer gets condemned to work at the power plant for some idiocy earlier in the episode, and his boss puts a sign above his workstation that says, 'Don't forget you're here forever.'

And Homer edits the sign to say, 'Do it for her.'

Because Homer has a why. He has a reason to endure and to carry on. And if Nietzsche is right, we all need to find our why.