Using humans is inefficient
Illithids can eat the brains of any humanoid, not just strictly humans brains, so why don't we go with something else? Obviously elves are out of the question, it's generally known that elves have lower birth rates than other humanoids (although whether this is due to biology or culture isn't readily known) Dwarves are in much the same boat, as are gnomes. Halflings and orcs, on the other hand, seem to be roughly similar to humans in regards to birth rates, with halflings having the distinct "advantage" of being small, rather than medium, and so requiring less overall space to ranch effectively.
But goblins, well, those are another story entirely.
Goblins? Yes, goblins! Rather than hundreds of humans, we can get by with only 8 mothers and a single stud per illithid.
But that's such a low number! How can we live off of so few? Well, here are some things we definitely know about goblins:
- Goblins mature somewhere around 33-55% faster than humans (depending upon edition). They reach maturity anywhere from the age of 8 (1e, 5e) to the age of 12 (3.5e/pf1e, variants in 5e), and live to about 50 years of age.
- Goblins are small, meaning that they'll require less space to ranch, and less total food over their lifetime.
What's hinted at but doesn't tell us anything specific:
- According to the entry on goblins from the 4e Monster Manual (pg.136) "Goblins breed quickly and can live most anywhere, from caves to ruins to a city’s sewers"
We can take this to mean they either have a significantly shorter gestation period, or that they reproduce in litters (both commonly accepted theories, and probably both are true). For the purposes of this, we'll assume a little of A and a little of B. Just pulling some probable (and in my opinion, conservative) numbers out of the air, let's say a typical litter size of 2-3 "pups" (avg 2.5), and a gestation period of only 6 months. For reproductive maturity, we'll average the different editions and say 10. This gives us a 33% shorter gestation period, a 150% larger birth pool, and a 45% faster maturation rate.
Other than those explicit differences, we'll assume all other statistics between goblins and humans are essentially equal. Building off of the baseline of using humans in this answer by PlayPatrice, and cutting down on the overall number of needed breeding stock accordingly.
Since we produce an average of 2.5 pups per mother per 6 month period, rather than 1 per mother per 9 month period, we can cut down our minimum stock proportionately. To produce the minimum necessary 12 per year with no sustainability in mind, we need a total of only 3 mothers. Each produces an average of 5 pups per year, leading to a total of 15 per year, so we have a slight surplus. If we take into consideration a health period of 2 years between the conception of each litter for optimal health, the same as a human, then we're only up to 5 mothers total, at a total production of 25 pups per 2 years, leaving us at only a very slight surplus of one pup.
In order to compensate for potential losses (1.5% mother mortality rate, 30% infant mortality rate) we'll of course, need more mothers. Since we can expect about 7.5 infant deaths out of 25 births in every 2 year period, we'll need an increased number of births to compensate, by another 1.5 mothers, which will produce the 7.5 more pups over 2 years. Obviously we can't have half a mother, so that rounds up to 2, for a total of 10 pups. Of course, 30% of those pups are also expected to die, so we'll need one last mother to compensate, bringing us to a total of 8 mothers minimum per illithid.
If we assume that the brains of pups are not nutritious enough due to lack of life experiences, then obviously older specimens are required. If we then say that reaching the age of maturity is good enough for minimal sustenance, then we want to have 12 pups reaching maturity every year, which we can certainly do with our 8 mothers, but the mothers won't last forever. It can be expected that since they die at an age of about half what a humans does, they also lose fertility and stop being viable as breeding stock at a similarly proportioned rate. Since humans have a (roughly) 18 year maturation rate and active fertility period, we'll assume that the goblins are proportionately similar, meaning that with a 10 year maturation rate they'll have a 10 year active fertility period. This means we'll need to replace our breeding stock fully every 10 years, but since we only need 8 mothers, we'll only need to get 8 viable females out of every 10th year. If we assume our goblins mothers aren't all the exact same age, this is fine, and we can replace them easily by selecting the best option out of the current year and exchanging it for the mother that is no longer viable.
All told, we're looking at a minimum of 1 stud, and 8 mothers, with roughly 125 offspring hanging around at any given time, as a permanent sustainable population of goblin brains to eat. You'll occasionally want to go out and capture a "wild" goblin in order to cut down on excessive inbreeding, of course, otherwise mortality rates could go up unnecessarily.
One other note to consider is that goblins are well known for being cannibalistic. If there's not enough food to go around, they'll eat their young. We can turn this in our favor, however, by reducing the overall feeding costs. Since the illithids only eat the brain, and the rest of the body is discarded, we can simply "recycle" it back into the feed, cutting down on the overall upkeep cost. This is a double-edged sword however, as it means that if food supplies are insufficient, then the tasty brains that are meant for the illithids will be killed and eaten before they mature, wasting valuable food resources. It is advised to have the goblins upkeep their own farm with edible plant matter and lesser livestock, in order to sustain themselves without being overly burdening on ones own finances.
As a last note, if we want to get past "the minimum to survive" and move towards "satisfied" then we can simply scale up the total population proportionately by simply multiply the number of total mothers we have hanging around. It will take total of about 32 mothers to produce enough offspring to eat a brain a week, although that means we'll have roughly 500 offspring kicking around at any given time. This is quite a lot for any one illithid to handle, and probably very time consuming to manage, so it's recommended that if one wants this much, they keep the majority of the livestock "free range" and only keep a herd consisting of the minimum necessary size in a more traditional enclosure.