With respect to the concept of gilgulim, we will begin the discussion with Adam HaRishon, the First Man, to more easily grasp the matter.
To begin with, when Adam HaRishon sinned he blemished all the sparks [nitzutzot] of his Nefesh, Ruach, and Neshama. Just like a person's body contains many sparks throughout his 248 Limbs and 365 Tendons, and consequently there are many sparks in his head, in his eyes, and in every limb--it is the same with a Nefesh as well.
The human body is comprised of the 248 Limbs and 365 Tendons, and as such they denote the form or "shape" of the human body. The body is composed of Holy Sparks..dispersed throughout it and within its limbs.
The Nefesh is in the same "shape" as the human body; more correctly said: the human body is in the same shape as the Nefesh. The body is composed of Holy Sparks that are dispersed throughout it and within every one of its limbs. It is exactly the same with the Nefesh, only more ephemeral.
When Adam HaRishon, the First Man, sinned, he blemished all the sparks throughout the spiritual form of his Nefesh, and his Ruach and Neshama as well. To explain this, the Arizal now digresses to a deep explanation of the Midrash.
The Midrash Tanchuma (Ki Tisa 12) and Midrash Rabba (Ex. 40:3) provide an explanation for the verse (Job 38:4), "Where were you when I founded the earth?"
Job is complaining about his lot, and arguing with G‑d. He answers him, "Where were you when I founded the earth?" In other words, G‑d is answering Job that he has no right to question G‑d unless he also knows from what part of the soul of Adam the spark that constitutes Job's soul originally came. If he does not know from whence his soul was hewn, then he does not know his own history. Consequently, he can never fully understand the things that are happening to him.
Actually, the Midrash starts off by quoting a verse from Ecclesiastes: "That which was/it was already called by name [from the beginning]/and it is known that it is Adam…" (6:10) In other words, all that exists "was already called by name" from the beginning, and that beginning or source is Adam HaRishon, when he was created.
When Adam was created, the Holy One, Blessed is He, showed him every righteous person who would ever descend from him: from his head, his hair, his neck, his two eyes, and some from his nose. His Ruach is also divided in this way, as is his Neshama.
From the sparks that comprised all the various limbs of the Nefesh, Ruach and Neshama of Adam were descended the souls of all the people that would exist throughout history.
When he sinned, he blemished the majority of the sparks of his Nefesh, Ruach, and Neshama, causing them to become immersed in the kelipot.
The kelipot are the husks or shells that imprison the fallen Holy Sparks. When Adam sinned, the Holy Sparks of his Nefesh, Ruach and Neshama fell into the kelipot. In the sense in which it is being used here, the concept of kelipot refers to the entire realm of evil into which the souls and the Divine Presence have been exiled. This realm is the mirror image of the realm of Holiness [Kedusha], but in the depths of spiritual impurity.
The Divine Presence is exiled amongst the kelipot.
This is the sod [meaning "secret"] of what is written in Sefer HaTikunim (Ch. 5), on the verse, "like a bird that wanders from her nest …" (Proverbs 27:8) The Divine Presence is exiled amongst the kelipot. The [souls of the] righteous tzadikim wander after Her from place to place.
This is talking about a quality naturally inherent in a human being that allows him to return to his Creator, as a bird does to its nest. The deeper meaning of the verse refers to Soul-Sparks of righteous people pursuing G‑d while they are within the realm of the kelipot.
The place to which the sparks are exiled in the realm of the kelipot is according to the aspect [of the soul of Adam] from which they have come. If they have come from the head, then they are exiled into the head of the kelipot; if from the eyes, then to the eyes, etc. This is the sod [meaning "secret"] of the idea of the "exile of the souls" that is mentioned there.
As explained, the spiritually impure world is a mirror version of the spiritually pure world, except in an unholy and impure way. Thus, when the souls fell into the world of impurity, they fell to the level that corresponded to their own. For example, the souls that are derived from the sparks of the eyes of Adam's Nefesh fell into the kelipot of the eyes of the Nefesh. If they fell from the thighs of the Ruach, then they fell into the thighs of the Ruach of the kelipot. It is from their specific place of exile in the kelipot that the soul-sparks must be redeemed.
[Translator’s note:The Hebrew words that have been translated here, "When Adam was created…," are "mutal golem." The implication of the word mutal is that he was lying around lifeless. The word golem will be more familiar, from the stories of the creature that was made by the Maharal of Prague. Whereas G‑d breathed into the lifeless lump that was Adam the spirit of life, the Maharal imbued the spirit of life into a lifeless lump by the use of Holy Divine Names.]
Thus, the literal translation of the Midrash at this point is as follows. "When Adam was a lifeless unformed lump…." Concerning that time it is written, "And the Lord G‑d formed the Man out of the dust from the ground, and He breathed into him a living soul…"(Gen. 2:7). It was at that moment also, according to our Midrash, that G‑d manifested the potential of all the human souls for posterity that would be descended from Adam, the Primordial Man.
[The verse quoted by the Midrash from the Book of Job (38:4) is: "Where were you when I founded the earth?" The Hebrew word for "where" is ayfoh, comprised of the letters alef -- yud -- peh -- hei. The Midrash notes that these letters can also be read as ayfah. An ayfah is an amount of dough that has not yet been kneaded into the shape of the loaf that will be baked. Therefore, the verse, when it is read with the indication [remez] ayfah, also hints at this moment when Adam was a lifeless lump, like an ayfah. This is the moment when G‑d gives form and life to the lifeless lump, and manifests the potential souls of the entire human race, the moment when Adam was created.]
[Commentary by Shabtai Teicher.]