There are many versions related to the disappearance of Lord Rama from the earth but it's the Padma Purana which sheds light on the way his life ended. The story goes like this…One day a sage came to Lord Rama and asked him for a private audience. The sage said that no one should enter the room in which they were having the conversation. Lord Rama directed Lakshmana to guard the door. He said to him that if anyone entered the room, he will be put to death. In some versions of Ramayana, it is said that this saint was none other than Kala Deva, or Time. While Lakshmana was keeping a watch, the short tempered sage Durvasa approached him and demanded entry. He was furious when Lakshmana stopped him. He threatened that he will lay a terrible curse of destruction on Ayodhya, its inhabitants and the entire Raghu clan. Lakshmana was in a fix! Then he concluded that his death would be a lesser calamity than the entire population of Ayodhya being destroyed. So he opened the door. He admitted Durvasa and received the punishment gladly. He decided every act of his, on the touchstone of Lord Rama's wish. He realized that this particular situation was the play of Time for him to disappear from earth. He agreed to the play of Kala and walked into the Sarayu River. The sage had actually appeared to remind Lord Rama, that the objective of his appearance on earth was complete. Lord Rama knew that those who take birth have to experience death. So he said, "Let Yama come to me. It is time for me to return to Vaikuntha, my heavenly abode". But Yama, the God of death, dared not enter Ayodhya as he was afraid of Hanuman who guarded the gates of Rama's palace. To allow Yama's entry, it was necessary to distract Hanuman. So Lord Rama dropped his ring into a crack in the palace floor and requested Hanuman to fetch it.
Hanuman reduced himself to the size of a beetle and entered the crack only to discover that it was no crack but the entrance to a tunnel that led to the Nag Lok, the land of serpents. He met Vasuki, the king of serpents there and informed him of his mission. Vasuki took Hanuman to the centre of Nag Lok where stood a mountain of rings. "There you will surely find Rama's ring," he said. Hanuman wondered how he would do that as it was like finding a needle in a haystack. But to his delight, the first ring that he picked up was Rama's. To his astonishment, even the second ring he picked up was Rama's. In fact, all the rings that made up the mountain were identical. "What is the meaning of this?" he wondered!
Vasuki smiled and said, "This world we live in goes through cycles .Each life cycle of the world is called a kalpa. Each Kalpa has four Yugas. In the second or Treta Yuga, Lord Rama takes birth in Ayodhya. Then one day his ring falls into the subterranean realm of serpents through a tunnel. A monkey follows it and Rama on earth dies. So it has been for hundreds of thousands of Kalpas. All these rings testify to that fact.” Vasuki continued, “The mountain keeps growing as more rings fall. There is enough space for the rings of future Ramas." ( Vasuki ) Hanuman realised that his entry into Nag Lok and his encounter with the mountain of rings was no accident. It was Lord Rama's way of telling him that he could not stop death from coming. Rama would die. The world would die. But Rama would be reborn each time the world is reborn. Lakshmana had accepted the punishment and took the form of Ananta Sesha. Lord Rama handed over his responsibilities to his sons and walked into the Sarayu River and disappeared. Soon, in the same spot, Lord Vishnu appeared, resting on Ananta Sesha and blessed his devotees