Commentary for Sukkah 3:5
אֶתְרוֹג הַגָּזוּל וְהַיָּבֵשׁ, פָּסוּל. שֶׁל אֲשֵׁרָה וְשֶׁל עִיר הַנִּדַּחַת, פָּסוּל. שֶׁל עָרְלָה, פָּסוּל. שֶׁל תְּרוּמָה טְמֵאָה, פָּסוּל. שֶׁל תְּרוּמָה טְהוֹרָה, לֹא יִטֹּל, וְאִם נָטַל, כָּשֵׁר. שֶׁל דְּמַאי, בֵּית שַׁמַּאי פּוֹסְלִין, וּבֵית הִלֵּל מַכְשִׁירִין. שֶׁל מַעֲשֵׂר שֵׁנִי בִּירוּשָׁלַיִם, לֹא יִטֹּל, וְאִם נָטַל, כָּשֵׁר:
A stolen or dried out ethrog is pasul. (An ethrog) from an asheirah or from a city gone astray (after idolatry) is pasul. (An ethrog) of arlah (forbidden fruit of the first three years) is pasul, [it being written (Leviticus 23:40): "And you shall take for yourselves" — it must be fit for you.] (An ethrog) of unclean terumah is pasul. Of clean terumah — he should not take it; but if he does, it is kasher. Of demai (suspect of not having been tithed) — Beth Shammai rule it pasul, and Beth Hillel rule it kasher, [it being fit for the poor, as it was taught: "The poor may be fed demai."] Of ma'aser sheni, in Jerusalem, he should not take it; but if he took it, it is kasher; [but not outside Jerusalem, for "for yourselves" must be satisfied, i.e., that it be fit for you.]
Bartenura on Mishnah Sukkah
English Explanation of Mishnah Sukkah
One from an asherah or a condemned city is invalid.
Of orlah or of unclean terumah it is invalid.
Of clean terumah, he should not take it, but if he did take it, it is valid.
Of demai (doubtfully-: Bet Shammai says it invalid, And Bet Hillel says it valid.
Of second tithe, it should not be taken [even] in Jerusalem, but if he took it, it is valid.
This mishnah deals with what makes an etrog invalid. Of the four species, only the etrog is a food and hence only an etrog is subject to the normal agricultural laws tithes, terumah, and orlah. The mishnah therefore focuses on these subjects.
Sections one and two: See mishnah one.
Section three: Orlah is fruit grown from a tree less than three years old. It is forbidden to eat such fruit or derive any benefit from it. Hence an etrog that is from an orlah tree cannot be used. Similarly, it is forbidden to eat or derive any benefit from unclean (impure) terumah. Therefore it too cannot be used in the performance of the mitzvah.
Section four: A pure terumah etrog should not be used to perform the mitzvah, although if it is used it is valid. In the Talmud they debate why it should not be used. The core of the reasoning seems to be that by using it he may ruin it from being a food and terumah is supposed to be eaten. Alternatively, by using a terumah etrog with the lulav he may cause the etrog to get wet and thereby susceptible to impurity [produce is susceptible to impurity only after it has been in contact with liquid].
Section five: Demai is doubtfully-tithed produce, produce that was purchased from someone who is suspected of not separating tithes. There is a frequent debate between Bet Shammai and Bet Hillel over the use of demai produce in the performance of a mitzvah. The talmudic explanation is that demai can be eaten by the poor. Since anyone can renounce ownership over all his possessions and thereby become poor, Bet Hillel holds that anyone can use demai to perform a mitzvah. In other words, every person is potentially a poor person. Bet Shammai holds that since it cannot be eaten by anyone but the poor it cannot be used as part of the lulav.
Section six: Second tithe must be brought to Jerusalem and eaten there. Nevertheless, the mishnah says that even in Jerusalem he should not use a second tithe etrog as part of his mitzvah. The reasoning is the same as that in section four concerning pure terumah. However, if he did use it he has performed the mitzvah, again the same rule as with terumah.