Trying to put it as simply as possible: getting to the final boss with only a few defeats will get you one ending. Getting to him after many defeats (I think four) will get you another.
And no, you don't have to fight all the normal enemies, as long as you can get around them.