When studying literature we must study not only its content, but also its form. This is especially true in the study of poetry, where the words themselves offer only a limited understanding of the text. Our Torah, in addition to being a description of the Divine, is a work of profound literature and poetry and our understanding of it is greatly enhanced when we apply literary analysis to its study.
The Torah presents the holidays in a variety of places and contexts, each adding additional layers of meaning to them. In parshiot Emor, Pinchas and Re’eh, the primary presentations of the holidays, they are presented as separate stand-alone units focusing on the mitzvot of the day, the sacrifices and the national celebration in Jerusalem, respectively. Yet in parshiot Mishpatim and Ki-Tisa, they are presented as an “adjunct”, following a seemingly unrelated series of laws (and narrative). These presentations are very similar, with much being a word-for-word “repetition”, making the context all the more important. The words may be the same, but the message is not.
Parshat Mishpatim presents Judaism’s civil code of law. Jewish life is hallowed by the mundane—via our treatment of slaves, animals, strangers and property. Just prior to discussing the shalosh regalim, the Torah presents a series of laws focusing on what might be called societal ethics: not oppressing the stranger, running away from falsehood, eschewing any form of bribery, letting the poor eat from one’s field in the shmitta year, and even highlighting Shabbat as an opportunity for rest for you, your family, your cattle and the stranger. It is in this context that we read, “Three times a year, celebrate for Me during the year” (Shemot 23:15), followed by a series of laws relating to the holidays.
Parshat Ki-Tisa has as its central theme the chet ha’egel, the sin of the golden calf, and it is in this context that the Torah presents the shalosh regalim. It follows on the heels of G-d’s revelation to Moshe of the 13 attributes of mercy and the re-establishment of the covenant with the Jewish people, something that was not at all certain to occur. The Torah most appropriately concludes the story of the golden calf with an admonition that “You shall not make for yourselves molten gods” (Shemot 34:17), and immediately continues with, “the holiday of matzot you shall observe...”, followed by a (mostly similar) series of laws relating to the holidays.
The shalosh regalim of parshat Mishpatim are celebrated as holidays reflecting our social system of equity. They are a time when we must ensure the poor and stranger are cared for; it is so easy to forget them as we celebrate with our families. It is for this reason that they follow a reference to shmitta and ensuring the poor are allowed free access to the fields, and explains why Shabbat is observed, “so that your servant and the stranger may rest.” (Shemot 23:12). We celebrate with the call to ensure that our justice system is impartial, eschewing any form of corruption, and that “we distance ourselves from falsehood.” Our holidays can be truly meaningful only in the context of a just society.
The shalosh regalim of parshat Ki-Tisa have a different focus. There is no mention of the poor, strangers or shmitta. Rather, they celebrate the special relationship between G-d and the Jewish people. It was on Pesach that G-d redeemed us from Egypt, on Shavuot when He revealed Himself to us through the medium of Torah and it is on Sukkot where we look to G-d to protect us from the terrible "winds" that often surround us. G-d cares greatly for us, and thus demands much from us. He often presents us with challenges and more. We rarely if ever live up to our potential, but G-d patiently waits for us to return. No matter how grievous the sin—and committing idolatry forty days after Divine revelation, a mere seven weeks after the Exodus, is pretty grievous—our relationship with G-d is never severed. Even, nay, especially after the golden calf, we are to celebrate the holidays, rejoicing in the power of forgiveness and our enduring relationship with the Divine.
Of course, the shalosh regalim of Mishpatim and Ki-Tisa are one and the same; the very similar language drives home that point. Our relationship to G-d is reflected in our relationship to man who is created in G-d’s image. It surely is not coincidental that the holidays of Mishpatim, of social justice, precede those of Ki-Tisa, of our relationship to G-d.
 The Torah defines itself as poetry (see Devarim 31:19). For a beautiful explanation of this idea, see the introduction of the Netziv to his Torah commentary discussed here.
 For an analysis of the differences of language that do exist see the commentary of the Netziv, Hamek Davar, Shemot 34:18-26.