No surprises here. The ending to "Rikki-Tikki-Tavi" is a straightforward ending to the typical hero-goes-a-questing story. But just for the sake of consistency, let's take a look all the same:
"Oh, it's you," said [Rikki-tikki]. "What are you bothering for? All the cobras are dead; and if they weren't, I'm here."
Rikki-tikki had a right to be proud of himself; but he did not grow too proud, and he kept that garden as a mongoose should keep it, with tooth and jump and spring and bit, till never a cobra dared show its head inside the walls. (110-111).
Like the true hero, Rikki-tikki defeated the threat to his home, the cobras. Although he takes a rest from his long adventure, he stays valiant in his destiny of being the hero and keeps his home safe from then on. Like we said, it's pretty straightforward, nothing too surprising.
Then again….
DVD Extra: Alternative Ending
Let's screw on the postcolonial lens and see if we can view this thing in a different light. If you check out our "Characters" section, you'll find that we discuss Nag and Nagaina as representative of India. After all, cobra imagery goes deep into Indian culture, and not just from fear of its poisonous bite. The culture also reveres the cobra, and the Hindu religion portrays it alongside some of its most important deities.
By defeating the cobras, Rikki-tikki has made the house safe for the British colonizers, but he had to destroy an important symbol of the Indian culture to do it. Here, the walls of the military encampment are seen less as keeping out cobras than as keeping the bungalow safe from India. Remember, during the time of the story, the British military maintained a presence in India to conquer and colonize the nation for imperial wealth, in part justifying its efforts by claiming to civilize what they saw as a "primitive" land (source).
In a way, we can almost see Rikki-tikki as a dark force in the story. As a creature native to India, Rikki-tikki conquers his native land for the comforts and trinkets of the bungalow, becoming a subject of colonization to do so.
Want more? Check out our "Setting" section for more on the bungalow and the garden as representatives of Britain and India.