This answer about R.Yishmael's 13 talmudic principles quotes the Artscroll siddur thus:
Prat U'Klal - When specific cases are followed by a generalization, the rule applies by any case in the generalization, and is not limited to the cases. An example would be that with regarding lost objects the verse says: "So too you should do to his garment, so too you should do to his donkey, so too you should do to any lost object of your brother". Therefore, one has to return all lost objects, and not just donkeys and garments.
This seems to suggest that the specifics are not actually necessary; the torah could have just given us the general law ("you should do to any lost object of your brother", in this case). But I was taught that there are no unnecessary words in torah. So what purpose do the specific cases serve?
Answer
Because the specific cases do teach us something about the scope of the general statement.
In this example, the Mishnah (Bava Metzia 27a) points out that a garment has unique identifying marks (simanim) and an owner who is looking for it (tov'im), and that this therefore delimits "any lost object of your brother": it has to be returned only if it has these two features. Which means, for example, that a mass-produced item that has no identifying marks, like a coin, need not be returned even if someone is claiming it; conversely, an item with such a mark, if you know that the owner has given up hope of finding it, needn't be returned either.
(Incidentally, this is an example of binyan av, the third of the 13 principles: a specific example serves as a paradigm for other, similar, cases. As Shmuel Brill pointed out in his comment to that question, the Gemara often uses this device without mentioning it by name.)
The Gemara (ibid.) goes on to point out that the Torah's mention of a donkey teaches us that, since a donkey and its saddle always go together (saddles are made to measure for each individual animal), then if you find a saddled donkey, and the owner is unable to provide a siman for the donkey but is able to identify the saddle, then you have to return both.
This is aside from the non-literal levels of meaning in the Torah. Again using this example, the Lubavitcher Rebbe zt"l, in one of his talks (Likkutei Sichos, vol. 1, p. 157) explains that each of the four specific lost objects that the Torah mentions (there are also an ox and a sheep mentioned two verses earlier) represent four types of people who have "lost their way" in serving G-d, each failing in a different aspect, but all of whom can be "returned" to Him through teshuvah.