Dvar Torah for Vayeishev (or Vayehi or Shemot)
I found this in Hebrew in מצפים לישועה by ישראל זינגער and I'll do my best to translate it.
The writer said: I found in קדושת ישראל a nice idea about our topic [the Geula] of which it is fit and proper to "place it on the king's table" [i.e. give it prominence] and this is what he said: I'm copying here something nice that I saw in יסוד העיקרים in שער כ"ג בתבנית יד, and this is what he said:
Haza"l said (Pesahim 56): Yaakov wanted to reveal the קץ - End time to his children and the Shechina was removed from him. He said, "Perhaps Has Veshalom there is a defect in my descendants?" His sons [then] said "Shema Yisrael". Yaakov Avinu opened and said, "ברוך שם כבוד מלכותו לעולם ועד".
I saw from one wise man who explained this based on what's explained in the writings of the ARIZA"L - that the Egyptian exile was due to the sin of the selling of Yosef, and the [brothers caused a] defect in the name "אהי-ה", whose gematria is 21 - and there were 10 tribes - 10 x 21 = 210 [the number of years the Israelites were in Egypt]. The verse says [by the episode of the burning bush] "וירא ה' כי סר לראות" [and Hashem saw that he had turned to see] - since Moshe Rabeinu ע"ה thought that their sin was in the Tetragrammaton, whose value is 26, and 10 x 26 = 260 [the gematria of סר] because Moshe Rabeinu did not know the name "אהי-ה" yet, and so he thought that their time to be redeemed had not arrived yet. So Hashem told him "אהיה אשר אהיה", which means that Hashem saw that he "turned (סר) to see" [which means] he [Moshe Rabeinu] saw that they should be in Egypt for 260 years. That's why Hashem informed him of the name "אהי-ה" and that's the name in which they made a defect - and that time [of 210 years] has already arrived.
However, there's a difficulty: only 9 tribes took part in the sale of Yosef since Re'uven wasn't there at the time. So, according to this [what we said above], 9 x 21 = 189 and they should have been redeemed in the year 190!
The answer is based on the Tanhuma and the Zohar that they [Yosef's brothers] joined the Shechina with them in this act so we count an additional 21 years because of Him כביכול - so now we nicely have the number 210.
This is the idea of the עשרה הרוגי מלכות who were [punished] due to the sale of Yosef. Hashem brought one because of Him, similar to the statement, "Bring upon Me an atonement." The Kabbalists say that each one of the עשרה הרוגי מלכות was a spark of another tribe, but Rabbi Akiva was because of Hakadosh Baruch Hu. And this is what was meant by Haza"l's statement, "שיצאה נשמתו באחד" [of which the simple explanation is that R' Akiva's soul departed at the word "Ehad" of the Shema] - because of The One - that is Hakadosh Baruch Hu. And that is the Kabbalistic meaning of the verse [talking about tithing animals] "העשירי יהיה קדש להשם" [the tenth will be holy for Hashem] since the tenth of the עשרה הרוגי מלכות was holy to Hashem.
And it appears to me that this is the intent of Haza"l who said about R' Akiva that the combed his flesh with iron combs, and the ministering angels said to Hashem, "This is Torah and this is its reward?!", whereby Hashem said to them, כך עלתה במחשבה לפני "Such has entered My thought before Me." This is an unbelievable [answer that Hashem answered them] since we could ask the same question on this statement itself "This is Torah and this is its reward?!" We could answer by saying that the angels only knew about the 9 tribes - they didn't know that the tribes joined [the Shechina] together with them - so they were wondering "Why was R' Akiva chosen since he was not from them or their descendants [as he is a descendant of converts]?!" To this Hashem answered כך עלתה במחשבה - such has entered My thought - that this will be a rectification לפני - before Me - for the fact that they joined Me also into their sale.
And this is what Haza"l said by Yaakov Avinu - since he knew that the defect was made in the name "אהי-ה" and he thought that they would be in exile for 189 years since Re'uven was not in their sale, and he didn't know about their joining the Shechina together with them. So he wanted to reveal the קץ - End time to them - that is, that they'd be redeemed in the year קץ which is the gematria of 190. However, when he saw in a heavenly vision that they would suffer some more until the year 210, he suspected that [his sons] had some other sins [not accounted for]. That's why he told them, "Perhaps you have a defect besides this?" The tribes then answered him in one voice and revealed to him the secret of joining the Shechina together with them. So, the elder [Yaakov Avinu] gave praise and thanks to Hashem for His humility, since [Yaakov Avinu originally] blamed himself as if he caused a defect like [his sons] that would require a rectification.
So this is the explanation of the statement of Haza"l: Yaakov wanted to reveal to his children that they would be redeemed in the year 190 [קץ] since he thought that 9 x 21 = 189 [is the length of the exile], and he didn't know that the Shechina was joined together with them. And that's what it means "ונסתלקה ממנה שכינה" that the Shechina was removed from him - the explanation is that the idea that the Shechina was together with them at the time that they made the vow - that was hidden from him. So when he saw that they would be enslaved more [than 189 years], he said "Maybe there's another defect." So the sons answered "Shema Yisrael - Listen, O father, the root of the matter - Hashem, our G-d was joined in on the act since we joined Him together with us. Therefore, you must add 21 years for Him too. Then, Yaakov Avinu saw that the calculation was exact so he gave thanks to Hashem for His humility for joining with them as a partner in their act, and said "ברוך שם כבוד מלכותו לעולם ועד" that it's fit to bless His holy name for his kingship and the honor of His glory.
And this is the expression of the Tanna in the Haggadda, ענו במלוכה פודה כהלכה - an explanation is since He is humble by joining Himself together with the Minyan of tribes, to count Him too, similar to the statement, "Bring upon Me an atonement," and the calculation nicely comes out to 210, and that's פודה כהלכה that the time of redemption is Kahalacha. This is because צדיקיו יאמרו לו His tzadikim will tell Him "לך ולך" - this is Yaakov, the chosen of the forefathers, who said "אף לך" - even to You and because of You did You calculate the redemption time, so there is no other sin, and therefore, the calculation is exact. לך ה' הממלכה to You, Hashem is the kingdom - to You it is fit and there is none like You.
He then quotes the sefer גאולת ישראל, who says a similar thing and fills in more details, ע"ש