There are four different endings in Trek to Yomi and the one you get depends on the decision you make before the boss fight of Chapter 7. This means that if you managed to survive all the enemies until then you essentially get to choose the ending of the game. Regardless of what ending you choose you will still have to defeat the same boss before you can see the ending cutscene. Take a look at our Endings Guide to get a breakdown of all the endings in Trek to Yomi.
To get the first three endings you need to lose the fight against the warlord Kagerou at the end of Chapter 3. You are expected to lose this fight anyway as it's what leads to your death and subsequent journey through Yomi. When you then defeat Hiroki's shadow Ara-Mitama at the end of Chapter 6 the spirit known as Nigi-Tama will offer you some gifts and prompt you to choose which path you would like to walk and give you three options from which to select from. The decisions you made up to the end of Chapter 6 ultimately have no effect on the ending of the game, it's only the decision at the end of the sixth chapter that decides the end.
Choose Love:
To get this ending Hiroki succeeds against Kagerou but chooses not to kill him. From there, he returns to Yomi to reunite with Aiko. This ending will get you the 'Follow Your Heart' achievement.
Choose Duty:
To get this ending Hiroki succeeds against Kagerou and chooses to kill him. From there, he helps his people rebuild before teaching a new child the ways of a samurai. This ending will get you the 'Follow Your Mind' achievement.
Path of Fury:
Reject the gifts to get this ending. Hiroki brutally executes Kagerou before bringing his people over to fight back against other settlements and bring them to ruin, essentially becoming the very person he swore to destroy. This ending will get you the 'Follow Your Blade' achievement.
It is important to remember that there is no option to re-choose the ending so unless you are planning on playing the game three times you should make a save file on the cloud or on a USB stick in the sixth chapter before making the decision. If you do this you will be able to complete one end, download the backup file, overwrite the active save and replay the game at the point where you make the decision in Chapter 6 as to what end you want.
In order to get the secret ending you need to play the game but avoid getting defeated by Shogun Kagerou at the end of the third chapter. This is a tough boss to defeat, so it is recommended you use the manual save trick above to quickly try again if you are unsuccessful. The video sequence will trigger after the second or at most the third hit you take from Shogun Kagerou and at which point you will no longer be able to repeat the boss fight without a backup save. This ending will get you the 'Early End' achievement. Take a look at our How to Defeat Kagerou guide to find out how you kill this demon boss.
Take a look at our Beginner Tips and Tricks to get help with Trek to Yomi.