Steins;Gate Ending, Explained
Okabe has to save Kurisu without unsaving Mayuri, which the show has spent twenty episodes proving is impossible. What Operation Skuld actually does.
Spoilers throughout. This page assumes you have finished the series.
Steins;Gate spends most of its length establishing that its central problem has no solution, and then solves it without cheating. That is why the ending has the reputation it has.
The trap
Okabe learns that the worldline where Mayuri lives is the worldline where Kurisu dies, and that the two are not a coincidence. Undoing Kurisu's death restores the sequence in which her research reaches SERN and the world ends up under it. Every route out that the series tries costs one of them, and the show is careful to make the reader feel the arithmetic rather than assert it.
What Operation Skuld does
Suzuha's time machine lets Okabe return physically to the night Kurisu died, and the requirement is exact: he has to prevent her death without contradicting anything his past self witnessed, because that observation is what drove every decision since.
His first attempt fails in the worst available way, with Okabe himself causing the death he came to prevent. What makes the second attempt work is a message from his own future self, which shows him how to intervene without unmaking the past he saw.
The result is the worldline he names Steins;Gate. Kurisu lives. Mayuri lives. Her research is lost before it can travel, so SERN never gets what it needed.
The cost, which is the point
The Kurisu who survives never spent those weeks with him. In her timeline, the events that made them matter to each other did not happen, and she meets him more or less as a stranger.
Okabe carries all of it alone. He is the only person who remembers every worldline, every failure, and every version of people who no longer exist. The happy ending is real, and it is delivered to a man who cannot share it with anyone in it, which is a considerably stranger note to end on than "he saved everyone".
Where Steins;Gate 0 fits
Between the failure and the success. It is the story of the worldline in which Okabe gave up, and it exists to explain a piece of the original ending: the message from his future self has to come from somewhere, and a future in which he never recovered is where. The sequel is not an epilogue, it is the missing half of the first ending's causality.
Endings where the protagonist pays privately and permanently are a small category. Code Geass is the other one on this site, and it makes the opposite choice about letting him live with it.