Simchat Torah and Shemini Atzeret are one day. Outside the Land of Israel, however, where all Festivals are observed for two days, they are separate. The first day is reserved for the joy of the Festival and for the prayers for rain, while the second day is reserved for the celebration of the conclusion of the cycle of reading from the Torah. (Some communities have the custom of making hakafot on Shemini Atzeret at night, to show that the two days are not actually two separate Festivals.) In Israel, where Simchat Torah is not celebrated on a separate day - since all Festivals are observed for a single day, the customs of Simchat Torah are observed together with those of Shemini Atzeret. It is said that the relationship of Shemini Atzeret to Sukkot is the same as that of Shavuot [which is also called Atzeret] to Passover. How?
On Passover, Israel achieved physical freedom. They witnessed the signs and wonders of G‑d and the awesome penalties which He exacted upon Pharaoh and the Egyptians, and Israel believed in Him and in His servant Moshe. Afterwards, they waited for a period of fifty days until the fear of Heaven was firmly implanted in their hearts, only then entering into the covenant of the Torah with G‑d, an entry punctuated by thunder and lightning so that the fear of God might always be upon them. And this, we celebrate with the Festival of Shavuot.
On Sukkot, Israel's soul achieves freedom from the evil inclination. They emerge from Yom Kippur purified and cleansed from their sins, they cleave to G‑d and find their shelter under the wings of His faithfulness. Since love for Him and joy in Him have been stirred, they immediately extend that love to the Torah, binding themselves to it in a bond of love and joy that does not weaken throughout the year for as long as they study its words. This covenant with the Torah is not accompanied by thunder and lightning, or by fear and trepidation, but by joy, song, and dance.
It is for this reason that Israel celebrates Simchat Torah on the Festival of Shemini Atzeret, for the atzeret that follows Sukkot is like the atzeret that follows Pesach. Just as the first atzeret [Shavuot] includes the covenant of the Torah as an essential component of its makeup, so too does this atzeret include the covenant of the Torah as an essential component. But while the first atzeret celebrates the freedom of the body accompanied by awe and fear, this atzeret celebrates the freedom of the soul accompanied by joy and love. Fear of G‑d is not complete unless it is accompanied by love, and love of G‑d is not complete unless it is accompanied by fear. As the verse states: And you shall rejoice in trembling (Tehillim 2:11) ? where there is joy there should also be trembling.
The Midrash notes:
It would have been fitting that this atzeret (Shemini Atzeret) also take place fifty days after the Festival of Sukkot, just as the atzeret (Shavuot) comes fifty days after Passover. G‑d said, however: "It is winter and they cannot leave their homes to come here (to Jerusalem). Rather, while they are still here, let them observe the atzeret" (Tanchuma, parshat Pinchas).
Although this atzeret is observed adjacent to the Festival, Israel does not suffer thereby. Had the first atzeret been observed adjacent to Pesach, the covenant might not have succeeded, for fear of G‑d had not yet been implanted firmly in their hearts. During Sukkot, however, when the covenant that they make is one of love and joy and follows their repentance during the Days of Awe, it does become implanted firmly within their hearts - for the strength of the penitent is greater than that of the righteous. While the latter requires seven weeks to reach this level, the former can achieve it in seven days. On Sukkot, all Israel are penitents, and they therefore come armed with great strength - augmented by the mitzvot of the four species and sukkah.