The Hindus believed that the soul went through a series of rebirths as it strived to obtain a oneness with the universal spirit, or Brahman Nerguna. They believed that when a person died, they would be reborn again, living many lives, until they perfected themselves. This state of perfection was called Moksha.
They believed that how a person lived their current life would determine the form they would take in the next life. If they lived a good life, and fulfilled all their dharmas or duties, they might be born into a higher varna or class in the next life. If they lived poorly, they might be born into a lower life, or even into a lower lifeform, such as a beetle or snake.
When one obtained this state of Moksha, their cycle of rebirth after rebirth would finally stop, and they would live in eternal happiness at oneness with the Brahman Nerguna.