Christopher Nolan's Interstellar is a sweet little movie with tons of heart, but without the last few minutes, the narrative would have an entirely different feel to it. Let's recap.
The sci-fi epic's premise revolves around the world dying. Earth's clock is winding down and not as a projection—it's happening. NASA scientists concoct a plan to colonize a new home on the other side of a wormhole as a last-ditch effort. Their fictional universe is much like our own, except a wormhole exists near Saturn. And several potential worlds lie waiting on the other side.
The astronaut team led by Brand (Anne Hathaway) and Cooper (Matthew McConaughey) venture there in hopes of saving the human race, but some stark truths come to light as they enter the separate universe.
One critical issue they face is how time passes for them in space. Due to time dilation, Brand and Cooper lose nearly forty years during one expedition alone. They don't lose anything themselves—it's just how much time passes while they're on an alien planet.
In Cooper's case, he can't afford to lose time. He left his ten-year-old daughter, Murphy, with the promise that he'll return someday, albeit without actually having a set date. The veteran pilot doesn't want to depart, but if he refuses, the world dies and his daughter with it. Thus, the choice gets taken out of Cooper's hands.
Unfortunately, one delay after another makes it seem less and less likely that Cooper will return home before the world perishes. Venturing through a black hole's horizon seems to confirm that he never returns, except that's not the ending.
Once Cooper enters the space, he's thrown into a physical presentation of the fifth dimension—a Tesseract. It's visualized as a nebulous space that Cooper bounces around without much direction. Eventually, though, the explorer realizes that he's behind the bookshelf in his daughter's room—the same bookshelf Murph thought a ghost was using to communicate with her.
Even stranger is the fact that Cooper sees through time. He watches Murph first encounter the anomaly, other instances of Murph in her room, and himself inside the room before he leaves for space. Cooper doesn't know what to make of the fifth-dimensional space until he pushes on the bookshelf, producing the same effect that convinced Murph a ghost was haunting their home. It then dawns on him that he's been behind Murph's bookshelf the whole time. Cooper was trying to communicate with himself in real-time—to warn himself to stay—but he could only manage to nudge the books.
After Cooper realizes that a version of himself has been banging on his daughter's bookshelf since before he left for space, panic sets in. He begins screaming uncontrollably. Interstellar looks like it'll end with Cooper tragically trapped, unable to ever spend another moment with his daughter, forced to view replays of his life.
Thankfully, his story doesn't end there. He is freed from behind the bookshelf when Murph solves the gravity problem. There's no longer a need for him to be in the space once Murph saves the world, so whoever—or whatever—sent Cooper there allows him to leave. They send him spiraling through negative space until landing near Cooper Station. He gets rescued not long after.
Interstellar Might Have Been A Dark Tale

Interestingly enough, Interstellar would've left audiences with a bit of a shock if Cooper never returned home.
For argument's sake, had the main character remained behind the bookshelf—inside the Tesseract—that would've been a miserable way to end things. Audiences were rooting for McConaughey's character from the very beginning, so a positive resolution felt unavoidable. Of course, it would've been believable for Christopher Nolan to cut to black after shooting Cooper into the Tesseract. The Dark Knight Rises director is known for ambiguous endings to his movies, after all. Fans have questioned whether Bruce Wayne survived the final act of The Dark Knight Rises or if Cobb actually made it out of Limbo in Inception for years, so it wouldn't have been surprising for Nolan to conclude his sci-fi epic with Cooper screaming for salvation that never comes.
Interstellar is currently streaming on Netflix.