Hoshana Rabbah and Vezos Habracha
And He was King in Yeshurun, whenever the sum total of the people were gathered, and the tribes of Israel were together.
Rashi first explains the word בְּהִתְאַסֵּף as בכל התאסף ראשי חשבון אסיפתם.
At every gathering of רָאשֵׁי - meaning, whenever their number is gathered. רָאשֵׁי as in the verse,“When you take the count (רֹאשׁ) of the children of Israel” (Exod. 30:12). These people are worthy that I should bless them.
He then offers another explanation: , בהתאספם יחד באגודה אחת ושלום ביניהם הוא מלכם, ולא כשיש מחלוקת ביניהם:
When Israel is gathered together in a unified group, and there is peace among them, God is their King-but not when there is strife among them. — [Sifrei 33:5]
My grandfather quotes the second one and draws a connection to Hoshana Rabbah. That day is known as the final seal for all the days of judgment from the DAys of Awe. During the Days of Awe, HKB"H shows his kingship in the role of Judge of the world. Accordingly, on those days we say Hamelech Hakadosh and Hamelech Hamishpat in the Amidah. However, though we revert to the standard text after those days, we have to maintain HKB"H as our King even after those days.
The answer lies in this verse וַיְהִי בִישֻׁרוּן מֶלֶךְ He is the King in Yehurun
When? בְּהִתְאַסֵּף רָאשֵׁי עָם יַחַד שִׁבְטֵי יִשְׂרָאֵל that is when they gather together on Chag Ha'asif the Sukkoth holiday. That is the ultimate manifestation of unity and peace among Yisrael. Then HKB"H is able to bring his Shchina among them and is thus their King.
My grandfather observes that that the custom of gathering together to learn Torah together on the last day of Sukkoth is fitting according to this reasoning.