In addition to the oppressive sadness that is the foundation of The Neverending Story, it is also incredibly meta. A couple of times during the nested narratives, Atreyu makes contact with Bastian, the child-god whose imagination is bringing Fantasia to unbelievably despairing life. But during the final moments of the film the Childlike Empress flatly explains to Atreyu that his whole life is just a story being read by boy in another dimension, and even more alarmingly, he is in turn simply the fiction of even greater watchers: us, the audience. It's turtles all the way down.
Of course Atreyu is rightly horrified by this revelation, and Bastian, who is also reading all of this, is equally confused, and the children, who are watching Bastian watch Atreyu, who have also just been referenced by the character within the story within the movie, are all dead from blown minds. This is also where it becomes clear that all of Fantasia may just be in Bastian's head, despite some earlier implications that it was a separate universe that he was accessing. Of course this means that all of the bleak destruction and scenes of dead horses are in Bastian's lonely, broken mind. Uh-oh.
So after all the sturm and drang of Fantasia's demise, giving the Childlike Empress a far out new name, ya dig, thereby returning Fantasia to all of its splendor, Bastian is granted infinite wishes. His first wish? REVENGE. He could have wished his mother back to life, or maybe for a nicer dad, or maybe to return that book he stole, but no. The first thing on Bastian's agenda? Bring a dragon into the real world and take vengeance of those who would put him in a dumpster. As the movie shows, Bastian gleefully runs down his bullies from the back of his new luck dragon, and as a grandfatherly voice-over lets us know, he goes to on have many more adventures.
But after staring down death and despair from Bastian's eyes for an hour and a half, it seems more likely that this ending is simply how Bastian saw things. Given that this whole adventure played out in Bastian's troubled mind, it's not likely that a dragon came roaring out of a book just to harass some kids. What's more likely is that from the outside Bastian hid in the school attic all night, slowly going out of his mind, only to emerge as some sort of totally cracked-out psychopath. The kids and even other bystanders looked reasonably shocked in those final images, but was it because they were witnessing the birth of a fantasy creature, or a serial killer? The Neverending Story is Rated PG for Please Godmakeitstop.