By telling the reader that the story has a happy ending, it relieves some of the tension that the reader is feeling and will feel throughout the book. The book is very tense throughout the second half. It's about a kid trapped on a lifeboat in the middle of the ocean with limited supplies. Add to that the fact that there is a tiger on the boat with him. That's scary stuff. Knowing that the story has a happy ending gives the reader some comfort.
It doesn't give the reader too much comfort, though. The narrator doesn't tell the reader exactly how the story has a happy ending. Happy for who? Pi? The tiger? Some other happy ending? All the reader is told is that the story has a happy ending according to the narrator. It doesn't tell the reader which happy ending it is, or even if the reader is going to like the ending. It's an interesting quote, because it relieves and adds tension all at the same time.
Shakespeare did the same thing with comic characters appearing soon after a tense moment in a play. On one hand the comic character is a relief to an audience filled with pent up energy, but at the same time the comic character delays the resolution of the tense moment. Thus tension is still built through comic relief.