The revelation is provided prior to the story of Pi's ordeal at sea to create anticipation and curiosity in the readers.
The revelation about a happy ending is likely provided prior to Pi's ordeal at sea to create anticipation, provide hope, and keep the readers engaged in the story.