There are 5 endings in the game. Here's how it determines which one you get: There's an internal variable called "mc_awareness", which is a list of binary flags. Most of your choices throughout the game set one of them if you pick the correct option. Near the end, a check is made on how many flags you've set, and that is the main thing that determines your ending. There are 13 flags, and it is possible to have all of them. Specifically, the flags are for:
- Trying to make MC refuse to check out the literature club at first
- Trying to make MC say that he reads horror on day 1 (he doesn't end up saying it, but it triggers the lines later in the conversation where he thinks about the horror book he read, "I think it ended with the main character's girlfriend hanging herself out of depression."
- Trying to make MC accept the invitation to officially join the literature club even without any convincing
- Seeing the first poem-triggered Sayori dream (MC has a dream about her each time you write a poem for her)
- Correctly remembering what Parfait Girls is about
- Correctly remembering what Portrait of Markov is about
- Skipping dialogue during Yuri and Natsuki's argument (it causes a different scene where MC doesn't pass out)
- Checking the poster at the end of day 2 (choose to "stay and look around")
- Second poem-triggered Sayori dream
- Seeing Yuri cutting herself in the hallway
- After that scene, loading a save so MC can stop her (it's the only time loading a save changes what happens, because other times the game overwrites your save as soon as MC would have a reason to go back)
- Seeing Natsuki's neck snap (this scene is in the original game; it's triggered if you saw Natsuki's first exclusive scene, and would have seen her second if Yuri hadn't pressured you into reading with her instead)
- Third poem-triggered Sayori dream
The Bad Ending: MC doesn't figure out what's happening in time, and Yuri dies. MC and Natsuki confront Monika, and after she admits the truth and asks the player to pick her, they kill her. Since too many characters have died, however, the game is too broken to revive Yuri and Sayori by putting their character files back. MC and Natsuki must make what they can of their horrible life confined to a fake and broken reality with most of their friends dead. This ending happens if your flag count is less than (9, -1 if you loaded a save to stop Yuri from cutting herself, -1 if you didn't see the third Yuri exclusive or walked out on her during it) when the time comes to save Yuri.
The Medium Ending: MC saves Yuri, but doesn't remember Sayori. MC, Yuri and Natsuki all confront Monika and kill her after she admits the truth. However, killing Monika broke the game too much to revive Sayori, and Yuri's mental condition is still near the breaking point, but at least they have the three of them. With luck, they'll be able to keep Yuri from going off the deep end, now that Yuri knows those thoughts are the result of an external force tampering with her mind. This ending happens if you have enough flags to save Yuri, but either had less than 10, or had seen less than two poem-triggered Sayori dreams.
The Good Ending: MC remembers Sayori before it's too late. He goes to her house and, with his awareness this high, he's able to hear you speak through dialog options. You tell him your plan to revive Sayori by restoring her character file. It works, and everyone confronts Monika. You kill Monika (see Perfect Ending if you choose not to), and MC and the three remaining girls have reasonable prospects for the future: since you started a new game, Yuri's insanity isn't as exaggerated as it was by the end of Act 2, and although Sayori's depression is still at its worst, her friends are there to comfort her, and now that she knows it's partly the result of tampering, she promises not to kill herself again.
The Perfect Ending: Same as the Good Ending, except you forgive Monika after she explains what she went through (this doesn't require any more flags, you just make the choice). Monika is able to undo what she did to the other girls, and everyone lives happily ever after.
The Evil Ending: MC joins Monika, and the two of them live happily ever after, god knowing what happens to Natsuki and Yuri. Why would you care when you think they're not real? This ending is the only one that doesn't depend on awareness flags at all. You simply have to write the first two poems for Monika.