MISHNA: In what manner does one tithe the animals? He gathers them in a pen and provides them with a small, i.e., narrow, opening, so that two animals will not be able to emerge together. And he counts the animals as they emerge: One, two, three, four, five, six, seven, eight, nine; and he paints the animal that emerges tenth with red paint and declares: This is tithe. Even if he did not paint it with red paint, or if he did not count the animals with a rod in accordance with the verse: “Whatever passes under the rod, the tenth shall be sacred to God” (Leviticus 27:32), or if he counted the animals when they were prone or standing in place and did not make them pass through a narrow opening, these animals are tithed after the fact. But if he had one hundred animals and he took ten as tithe, or if he had ten animals and he simply took one as tithe, that is not tithe, as he did not count them one by one until reaching ten. Rabbi Yosei, son of Rabbi Yehuda, says: In that case too, it is tithe. If before the owner completed tithing his animals, one of those already counted jumped back into the pen among the animals that had not yet been counted, all those in the pen are exempt from being tithed, as each of them might be the animal that was already counted. If one of those animals that had been tithed, i.e., designated as the tenth, jumped back into the pen among the animals that had not yet been counted, creating uncertainty with regard to all the animals there which was the animal tithe, all the animals must graze until they become unfit for sacrifice, and each of them may be eaten in its blemished state by its owner once it develops a blemish.
The Sages taught in a baraita: “Whatever passes under the rod, the tenth shall be sacred to God” (Leviticus 27:32); this teaches that all animals may be sanctified as animal tithe, excluding a tereifa, as on account of its physical state it does not pass under the rod. The phrase “under the rod” teaches that it is a mitzva to count them with a rod. If one did not count them with a rod, or he counted them when they were prone or standing, from where is it derived that the tenth animal is nevertheless sanctified? The verse states: “The tenth shall be sacred,” indicating that the tenth animal is sacred in any case, even if it was not tithed correctly. The baraita continues: And I have derived only that an animal that one explicitly called by the name of the tenth one is the animal tithe. From where do I derive that the tenth animal is sanctified even if one did not explicitly call it the tenth one? The verse states: “Shall be sacred.” This teaches that it shall be sacred in any case, even if it was not called the tenth. One might have thought with regard to one who had one hundred animals and simply took ten of them without counting them, or one who had ten animals and took one of them without counting, one might have thought that they should be considered tithed. Therefore, the verse states: “The tenth,” and this animal that he removed is not the tenth, as he did not count the animals. Rabbi Yosei, son of Rabbi Yehuda, says: Even if he simply removed one animal from ten without counting, that animal is tithe.
Excerpt from Unetanah Tokef
All who have come into this world pass before You like young sheep. As a shepherd inspects the flock, making each sheep pass under the rod, so do You cause to pass, count, number, and review the soul of every living being, determining the life-span of every creature; and You record the decree of the judgment.