Many books have been written explaining the teachings of the Arizal on the subject of "reincarnation" or gilgul (גִלְגוּל). These books explain when and how reincarnation takes place and give details regarding many soul-roots and how we find them reincarnated in the Bible and afterwards in the time of the sages, and even up to the time of the Ari himself.
The Ari traced the gilgulim of archetypal souls from Adam until his own generation and explained that in addition to the purpose of rectifying blemishes of previous lifetimes, each successive incarnation is in order to manifest and rectify a new, different dimension of the same soul.
According to the teachings of the Ari, Adam becomes David who will finally be reincarnated as the Messiah, as indicated by the fact that the initial letters of Adam David Messiah (alef, dalet, mem) spell Adam (אָדָם). All were contained within the soul of Adam. Similarly, the three letters that comprise the name of Moses, Moshe, (mem, shin, hei) stand for the initials of Moses Seth Abel, the three primary incarnations of this archetypal soul from future to past.
The Ari was able to reveal to his disciples their past incarnations so that they would be able to rectify the blemishes of the previous lifetimes in this one and continue to reach new and higher levels of consciousness.
According to the Ba'al Shem Tov, it is not necessary to reveal this information to every individual. Sometimes knowing our last life history can be detrimental to our rectification in this life. This knowledge can confuse the mind and not allow us to be open to achieve good in a simple and pure fashion; thus, that kind of knowledge can narrow our consciousness as opposed to broadening it.
It is important to understand that in Judaism reincarnation is in no way cruel or fatalistic, as is usually the case in other traditions. Judaism instructs us to always be concerned with changing the reality of this world for the better. For a Jew, the world in which we live is real and has meaning and purpose. Indeed, all of the worlds were created for the sake of this world, in order that by our good deeds we make this lowest realm of existence a dwelling place for the Almighty. Every successive incarnation is another chance, benefiting from an input of new Divine energy, for succeeding in one's holy mission on earth. In the end we will all succeed in this mission. Helping another succeed in his life's mission is an intrinsic part of one's own success.