Yehudah’s Descent
After the sale of Joseph into captivity by his brothers, Yehudah, who suggested selling Joseph rather than killing him, “descended” from his brothers and got married. His wife bore him three sons. He married his oldest son, Er, to Tamar. After she was widowed, she married Yehudah’s second son, Onan. When he died too. Yehudah decided that Tamar should remain a widow because he was reluctant to allow her to marry his last son, Sheilah.
After Yehudah’s wife died, Tamar disguised herself as a harlot, Yehudah propositioned her and promised to send her a goat to pay for their liaison.  When she asked him for his signet ring, cloak and staff as collateral against that promise, he agreed.
We know that the Torah does not just tell us stories. Each and every detail is fraught with meaning and contains many deeper and deeper layers of knowledge.
Why would the Torah go into such detail about Yehudah’s payment and collateral for this relationship? The question begs that we seek a deeper understanding of this entire episode, especially since it was from this union that Peretz was born. Peretz is closely associated with Moshiach. First, he was the direct ancestor of King David, from whose line Moshiach would emerge. Second, the very name Peretz means “to break out of boundaries” which aptly describes Moshiach.  It is his role, as one whose influence is “out of the box”, to break through the walls of Galus.
The fact that Peretz’s birth is associated with the items Yehudah gave as collateral (his signet ring, cloak and staff) suggests that these three items may symbolize an unconventional leadership.
Leadership, Leadership and Leadership
The Midrash on this verse connects these three items to three forms of leadership. The signet ring represents royalty and refers specifically to Yechaniah (or Chaniah), the last monarch to reign before the Babylonian exile. In his lament of the imminent exile, the prophet Jeremiah decribes G‑d as exclaiming: “”…though Chaniah the son of Yehoyakim king of Judah were the signet upon My right hand…” (Yirmiyahu 22:24). Hence Tamar’s prescient demand for the signet ring was prophetic and alluded to their offspring’s future role in royalty.
The Midrash also teaches the figurative meaning of the cloak and staff Yehudah gave Tamar: “The cloak refers to the Sanhedrin… and the staff refers to the King Moshiach, as it is stated: ’And there shall come forth a shoot out of the stock of Jesse…’ (Isaiah 11:1), and it is stated ’G‑d will stretch forth your mighty staff from Zion…’ ” (Tehillim 110:2)
How can we understand why Tamar prophesied about these three periods of leadership that would emerge from her union with Yehudah?
If she was predicting royalty that royalty would emerge from her union with Yehudah, why did she not allude to Kings David and Solomon?  After all, they were the progenitors of the Davidic dynasty and laid the foundation for and actually built the Bais Hamikdash.
Resisting, Coping and Surviving the Exile
Tamar saw even further into the future of the Jewish people and realized that it would be a long trek before Moshiach ushers in an age of spiritual and physical perfection. The Jewish people would need to go through much travail before their redemption. When she gazed penetratingly at the future, she saw that there would be three periods in which her descendants would serve as the support for the Jewish nation before the final Redemption.  Each period would require a different stage of leadership.
The first stage of leadership she saw was when the last king reigned before the Babylonian exile. She saw that he is associated with G‑d’s seal. What is a seal? It is a sign of confirmation and permanence revealed, in this context, through the unique impression left by the design of a signet ring. Moreover, our Sages tell us that “G‑d’s seal is truth.” It is ironic that this manifestation of G‑d’s seal occurred precisely when king Yechaniah (or Chonia), a scion of the Davidic dynasty, was on the threshold of Babylonian exile!
Tamar, however, saw it differently. On the surface it seemed that the leadership of the king Chonia and the Davidic dynasty was coming to an end. Tamar, however, knew that G‑d would promise David that “his light will never be extinguished.” Tamar was prophetically aware that David’s descendants would continue to exercise influence over the exiled Jewish people. They helped enable the people to cope with the harsh realities of exile and keep the Jewish community intact. This was in stark contrast with the 10 “lost” tribes exiled a century earlier who assimilated and disappeared from the Jewish community.
Tamar was not satisfied. It was not enough just to survive and cope with adversity. A Jew comes into this world to grow and thrive spiritually. What will keep them going even when the overt role of Davidic royalty ceases?
The answer she received in her prophetic words was the “cloak.” This was a reference to the mantle of leadership vested in the Sanhedrin, an important institution that flourished and exercised incredible influence over Jewish life for many centuries. The Sanhedrin leadership included descendants of Tamar and Yehudah. It did far more than just keep the status quo. The Sanhedrin and its heirs, the Torah Sages of Israel, guided the Jewish people to incredible life and growth.   
The Staff and the Branch
Tamar’s prophecy did not end there. She saw a third element, the mateh­-staff which symbolized the final stage in the Galus saga: Moshiach and the Redemption he leads.
The Hebrew word for staff, mateh, is often contrasted with its synonym, shevet. The difference is that the shevetrepresents the branch of the tree when it is still connected to the tree, whereas the mateh describes that very same branch once it is detached from the tree and hardened into a staff.
Upon reflection, we can see that the mateh possesses a paradoxical nature. On the one hand, it lacks the life and vibrancy of the shevet. The mateh is no longer connected to its source of life, yet, the mateh is firm and unbending, unlike the pliable and flexible shevet. What do these diametrically opposite features symbolize?
The Rebbe, in a talk on the Torah portion entitled Matos (Likkutei Sichos, Volume 18, p. 382), explains that the detached state of the mateh symbolizes the state of the soul when it descends into our physical world to inhabit a body. It is no longer “attached” to its heavenly source, unlike the soul when it is still in its G‑dly abode prior to descent into our world.
However, as a result of the challenges that the storms the soul must weather down here, it must be endowed with additional power. The soul, detached though it may be down here, possesses a superior strength that it receives from the soul’s very essence.  Kabbalah and Chassidus refer to this strength as the eisan, the hard-core strength of the soul. When in its heavenly abode, the soul does not need that powerful attribute, which remains dormant until the soul’s descent into the physical world.
Furthermore, as we meet the challenges of the physical world and overcome its obstacles, the soul’s eisan further strengthens us and reveals the even greater power of the soul.
In his discussion of the difference between the shevet and mateh states of the soul, the Rebbe also draws a parallel to the period in history when we had our Bais Hamikdash-Holy Temple and then our subsequent period of exile.
When the Bais Hamikdash stood, G‑d’s glory was revealed to the world, overt miracles abounded and the Jewish people were in the shevet state; they felt their attachment to G‑d. However, as a result of the Galus exiles we lost that state of attachment and were relegated to the mateh state.
Precisely because we have soujourned in this detached state of Galus for nearly two millenia, we have been forced to elicit the most powerful forces from the essence of our souls. Galus has revealed within us that we have unprecedented powers to resist the darkness and even convert it to light.
The staff that Yehudah, the progenitor of Moshiach, gave Tamar as collateral, represented the future power of Moshiach to cope with Galus conditions and enable all of the Jewish people he leads to summon their own eisan. The Rebbe explains that Moshiach is a Galus leader who brings out the best in us to resist, cope, manage, thrive, and then transform the Galus into the triumphant Geulah-Redemption.
“Give Me the Power of the Mateh!”
We can now read the story of Yehudah and Tamar more deeply in a new, uplifting fashion:
Tamar represents the Jewish people. Yehudah (whose name contains the four letters of G‑d’s sacred name) is a metaphor for G‑d, who saves the Jewish people from the state of widowhood, i.e., estrangement from G‑d, the metaphoric “husband” of the Jewish nation.
Yehudah (read: G‑d) asks us: “What collateral shall I give you to guarantee your survival until I bring the Redemption? What power do you need to preserve yourself in the bitter harshness of Galus so you can prepare for and experience the glory of the Redemption?”
Tamar (the Jewish people) answers, “It is the signet ring, the cloak and staff … that you have in your hand.” It is the power of royalty found in G‑d’s hands that He passed over to us (Tamar). We never lost the regal status that this conferred upon us and which was responsible for our survival, even in exile.
Beginning with Yechaniah, continuing through the Sanhedrin (and their spiritual heirs, the Sages and teachers of Torah throughout the ages), and finally through Moshiach himself, we were and are empowered to survive, even thrive and eventually transform our exile. Indeed, the true purpose of a leader is to reveal the power of royalty and leadership that resides in each and every one of us, so we can be masters over our lives and our Galus environment.
Moshiach’s role in particular is to reveal the spark of Moshiach, the mateh and the eisan, that exists within each and every Jew and by so doing, conclude Tamar’s vision for the future and usher in the ultimate Age of union between Tamar (the Jewish people) and Yehudah (G‑d).