The Mishnah states plainly that a sukkah taller than twenty amot is invalid, while Rabbi Yehuda deems it fit, and Sukkah 2a:1 records the dispute along with Rabba's reasoning that above twenty amot a person's eye no longer registers the schach and so does not feel himself dwelling in a sukkah, deriving this from the verse "so that your future generations will know" (Vayikra 23:43).
Sukkah 2a:12-14 gives a second reasoning, that up to twenty amot a person makes his dwelling a temporary one by choice, but above that height a dwelling is inherently permanent and cannot be made temporary, which is why the sukkah is invalid there; Rashi (Sukkah 2a:8-9) explains that the point of the verse is that one's sitting under the sukkah must be recognizable, tied to the eye not being able to take in the schach once the structure is too tall.
The codifiers rule this way as halacha: Mishneh Torah, Sukkah 4:1 sets the maximum height at twenty amot and invalidates any sukkah taller by any amount, and Shulchan Arukh, Orach Chayim 633:1-3, Tur, Orach Chayim 633, and Beit Yosef, Orach Chayim 633:1-3 all codify that a sukkah above twenty amot is invalid whether large or small and whether or not its walls reach the schach.
Arukh HaShulchan, Orach Chaim 633:1 explains the underlying principle that a sukkah is meant to be a temporary dwelling, and a person can only make a dwelling temporary up to twenty amot in height; beyond that the Torah is concerned that it can no longer function as a temporary dwelling, so the halacha invalidates it regardless of which amora's reasoning one follows, while Tosafot (Sukkah 2a:8) and Mishnah Berurah 633:1-3 further analyze the competing reasons for the twenty-amot limit found in the Gemara.
Importantly, the limit is on the interior airspace under the schach, not on the walls themselves: Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 633:3 states that the wall of the sukkah may be built higher than twenty amot, and the restriction applies only to the space beneath the schach not exceeding twenty amot, while Shulchan Arukh, Orach Chayim 633:1-3 likewise notes that even if the schach itself sits higher than twenty amot, the sukkah remains valid so long as its interior airspace is only twenty amot.
Related technical details appear as well: Kitzur Shulchan Arukh Yalkut Yosef, Orach Chaim 633:4 discusses the principle of extending the walls upward (gud asik mechitzta) to validate a sukkah whose actual walls do not reach the schach, and Sukkah 5b:7-9 and Rambam Introduction to the Mishnah 2:17 address the minimum height requirement of ten tefachim on the other end of the scale, a point also noted by Nitei Gavriel, Sukkos, perek 23.
Ohr LaYesharim on Jerusalem Talmud Sukkah 1:1:5 discusses how decorations hung in a sukkah taller than twenty amot can, if they are themselves fit for schach, diminish the excess airspace and render the sukkah valid, while Beit Yaakov, Bechukotai 84 frames the twenty-amot limit homiletically as reflecting that structures above that height lack effective human oversight, extending the same idea to a mavuy.
On the specific practical question of a sukkah built atop another sukkah, Revavos Ephraim 7:170 cites the Biur Halachah's position that the upper sukkah may be built more than twenty amot above the ground, so long as it is within twenty amot of the roof of the lower sukkah beneath it, referring further to the Emek Berachah and Bikkurei Yaakov for extended discussion.