In order to be eligible for the happy ending, you will need to have rescued all the classmates you've been encountering throughout the game. If you have done so, you will automatically be viewing the good ending upon finishing the game. If you were not able to rescue all your classmates in your initial playthrough, go back to the stages you messed up on and rescue them, then defeat the final boss again. You do not need to replay the game again.