How does the ending work in The Last of Us Part I?

Quick answer: Joel saves Ellie from the Fireflies, killing those in his way including Marlene, and later lies to her about what happened. The choice is made by the story, not by you.
Show walkthrough (story spoilers)
Joel’s decision
Joel reaches Ellie and takes her out of the hospital. He kills the people who stand in his way, including Marlene.
The lie
Later, Ellie asks what happened. Joel tells her a lie to protect her. The game ends on that moment.
No alternate endings
There is only one ending. For more context, see the Salt Lake City walkthrough.
