There are a few ways to "fail" in Persona 5. For instance, failing to complete a palace by the game’s designated end date will kick you back to the beginning of that free period. However, there is one true ending and it is very easy to achieve.
SPOILER WARNING: From here on out, this guide will contain major spoilers for Persona 5. If you are worried about getting the true ending, follow our December guide. It will teach you to navigate the scenario and is very light on spoilers.
After completing the final dungeon, The Prison of Regression, the true nature of the Velvet Room will be revealed. It turns out, Igor is not actually Igor at all, and is instead Yaldabaoth, the God of Control. Toward the end of this reveal, he will offer you a choice. You can choose to rebel or to give up.
Answering with "Very well ..." will net you one of the bad endings. Persona 5 will end here, and you will not fight the final boss. Answering with "I refuse" will get you the true ending.
That is all you have to do to guarantee that you get the true ending. The final boss fight is not for the faint of heart, a true trickster can take it down.