The Torah itself uses only the terms "tekiah" and "teruah" (Num. 10:3ff). Elsewhere (Lev. 25:9) the Torah puts the verb haavir ("to make pass") before and after references to a teruah, implying that it should be preceded and followed by a long drawn-out sound - which tells us that the basic order is tekiah-teruah-tekiah.
So there's no doubt what a tekiah is. However, the word "teruah" is translated in Aramaic as "yevava," which means a crying sound, and there are three possibilities what this means: moaning (medium-length sounds, what we call "shevarim"); sobbing (short sounds, what we call "teruah"); or both, first moaning and then sobbing. Already in the era of the Mishnah there was uncertainty which of these three is the true "teruah"; accordingly, it was instituted that we do all three.
(Talmud, Rosh Hashanah 33b-34a; Shulchan Aruch Harav, Orach Chaim 590:1-2)
[How this uncertainty came about is itself the subject of dispute. R. Hai Gaon explains that in reality, any of these three would satisfy the Torah obligation of hearing a crying sound, so various communities did it in various ways; the enactment to do all three was in order to unify the various practices. By contrast, Rambam writes (Shofar 3:2) that the true original meaning of "teruah" was actually forgotten, and so we do all three to be on the safe side.]
Returning to tekiah, it can be drawn out as long as you want (Shulchan Aruch Harav, Orach Chaim 590:4). So the custom developed to make the last one (of the first set of 30 sounds) extra-long ("tekiah gedolah"), also symbolizing the idea (from Ps. 47:6) that G-d's presence "ascends with the sound of the shofar." But it's not a halachic requirement.