As focused as I usually am on O/AD&D (1E), I got to wondering how the listed monster numbers appearing evolved over later editions of D&D. Here, have a chart (above). To make this relatively feasible, I'm limiting this to the "normal"-type monsters, i.e., those with generally 1 hit die and appearing in some kind of large-scale society. Along the way here we'll wind up exploring the shift in sensibility around "random encounter tables", the "default ecology" built into monster descriptions and the core rules, and the connection to fighter "sweep/cleave" attacks.
Original D&D
In the table above, I've picked out the 11 "normal" monster types in OD&D, and kept the original order (which is: chaotic types 1st, lawful types 2nd, increasing strength in each group). These are all the monsters that have numbers appearing into the hundreds; and they're also all the types against which fighters get "sweep" attacks, since they're all in the 1-hit-die range. (Exception: you're probably familiar with gnolls having 2 hit dice, but in the pre-publication draft of D&D, they had 1+1, hence the high numbers we presume.) The "Bandits" stands in for the "Men" catch-all of Bandits, Brigands, Buccaneers, Nomads, etc.
It bears keeping in mind that the footnote to the table (Vol-2, p. 4), says the number appearing stat is "used primarily only for out-door encounters", and this detail is maintained in most of the editions we're talking about here. There is of course some amount of debate (given the sketchiness of OD&D; that's literally all it says on the issue) about the intent or utility of these huge numbers. Many people interpret it as only in-lair numbers; Arneson in First Fantasy Campaign kvetches a bit, and stipulates that only 10-60% of these numbers should be encountered wandering outside the lair.
AD&D 1st Edition
The numbers from OD&D above are almost all transcribed identically into 1E. Specially: 7 of 11 (64%) are exactly the same. Some minor modifications are made to bandits, nixies, pixies, and elves -- in each case in the downwards direction. Pixies in particular took a more severe cut than the others.
The Monster Manual likewise says on the figure (p. 5): "It is not generally recommended for use in establishing the population of dungeon levels." The "sweep" attack rule is explicitly given to all fighters in these rules (albeit limited to under-1-HD types; PHB p. 25).
AD&D 2nd Edition
In 2E, designer Zeb Cook et. al. start to shake things up -- in a way that's inconsistent. In some cases they've dialed down the numbers appearing in the stat block significantly, and in other cases they haven't. Most of the monstrous types were reduced in numbers (exception: orcs), while most of the demi-human types were not (exception: gnomes). That said, even for the types that were downsized in the stat block, the text entry under "Habitat/Society" in every case specifies a lair group that's back to the 1E numbers. As a result: if you merge the 2E "Stat" and "Text" columns in the chart above (take the maximum in each case), then you perfectly recreate the 1E numbers.
For this survey, I'm looking at both the 1989 Monstrous Compendium (looseleaf binder) and the 1993 Monstrous Manual (hardcover book) products. The stats and descriptions all seem to be identical. Both of them still say the number appearing stat "indicates an average encounter size for a wilderness encounter... This should not be used for dungeon encounters".
So it appears that Zeb & co. mostly just reduced the numbers of the hostile monsters you're expected to fight in random encounters in the wilderness (exceptions as above), while keeping the lair numbers the same as in 1E. Also, the given ratios of leaders, chieftans, wives, etc. seem to be identical as in the 1E text. Parallel to this: note that in 2E the fighter "sweep" attack mode becomes an optional variant for the first time (and kind of hard to find in the DMG).
And this overall strategy is the same that Zeb used in his earlier D&D Expert set rules, as part of the B/X series. Monsters there have a fairly small standard number range, a parenthetical larger number for lair-or-wilderness encounters, and a frontispiece text note to multiply that number by five for lair-and-wilderness events. E.g: Basic game orcs have numbers 2-8 (randomly around the 1st level), or 10-60 for lairs-or-wilderness, or a product of 50-300 for lairs-and-wilderness. Cook in the Expert rules fielded the Men entry, such as Brigands, Buccaneers, Dervishes, etc., and in the their text blocks gave additional guidance for camp numbers, echoing the maximum 300 number from OD&D (even though this doesn't exactly line up with the multiply-by-five formula)
Note the (*) in the entry for orcs in the table above. Uniquely, the "Habitat/Society" text has this bit of extra love for the orcs:
Orc communities range from small forts with 100-400 orcs to mining communities with 500-2,000 orcs to huge cities (partially underground and partially above ground) with 2,000 to 20,000 orcs.
Also: Did Jim Holloway illustrate every single monster in the entire Monstrous Compendium!? Holy smoke, that's a lot of art! I shudder to even think about it.
D&D 3rd Edition
Now, in 3E, the monster stat blocks tend not to have just one number appearing value, but several, for an array of different grouping structures. For example, here's the one for goblins:
Organization: Gang (4-9), band (10-100 plus 100% noncombatants plus 1 3rd-level sergeant per 20 adults and 1 leader of 4th-6th level), warband (10-24 with worg mounts), or tribe (40-400 plus 1 3rd-level sergeant per 20 adults, 1 or 2 lieutenants of 4th or 5th level, 1 leader of 6th-8th level, 10-24 worgs, and 2-4 dire wolves)Sort of makes sense, and gives the DM some ecology-sensible different options for the situation that presents itself. In the chart at the top I've just taken the highest grouping for each monster. Note again that in a number of cases (4 of 11) this winds up being a restatement of the numbers from back in 1E, and in the others, the numbers are modifications on about the same scale. There's no strict consistency to the modifications: orcs go down, gnolls stay the same, hobgoblins go up, etc.
A major thing that changes with 3E is this: Whereas all the prior editions had a "baseline world ecology" baked into the core rules in the form of comprehensive wilderness encounter tables (which went on for many pages in various AD&D books), 3E ends that practice. Instead (DMG Ch. 4), the DM must build their own, with a guideline that each terrain type should have a constant Encounter Level (EL) range -- and the numbers for each monster filled in appropriately to meet that EL. There's no explicit tie-in to the Organization grouping from the Monster Manual either: the important thing is that the EL be right, regardless of other ecology issues.
Jointly with the preceding fact, there's no need to state that the numbers appearing are wilderness-only -- they may or may not be, as the area-based Encounter Level requires. (In contrast, there are comprehensive default dungeon encounter tables given in the DMG.) In addition: These rules have no general feature of fighter "sweep" attacks (Fighters must choose to spend a Feat slot on either the Cleave or Whirlwind Attack ability for that).
D&D 4th Edition
The remaining editions are left out of my chart at the top for a simple reason: they just don't have any "number appearing" stats in the monster descriptions at all. And they also don't have any premade encounter tables of any sort -- either for the dungeon or wilderness.
What 4E does have (DMG Ch. 10) is a brief section describing how DMs might randomize encounters on the fly, by first rolling a difficulty level relative to the PCs, then an encounter template specifying the "roles" of the monsters in question, and then picking from appropriate-level monsters on an ad-hoc basis from the Monster Manual. So at this point we have no broad sense of "ecology" for different monsters, except insofar as they interact in a balanced fashion when fighting against PCs (as represented by the 5 "[combat] role" classifications in the game). We don't even have the 3E recommendation that different regions have different native danger levels -- rather, wherever the PCs go, that's how strong the monsters are.
D&D 5th Edition
Like 4th edition, the 5E game has no built-in stock numbers for monster listings, and no premade encounter tables. In fact, there's even less guidance on the issue than in 4E. There's only 3 brief pages on the issue (DMG Ch. 2), with no distinction between dungeon/wilderness, no guidelines to gauge danger levels as in 3E/4E, and even a broad discouragement against the very idea:
Not every DM likes to use random encounters. You might find that they distract from your game or are otherwise causing more trouble than you want. If random encounters don't work for you, don't use them.
And with that, the whole presentation of a sample world "ecology", monster organization by type, and random encounters in general, seems to be pretty much dead and buried.
Conclusions
In O/AD&D, the very idea of a monster included an inherent (if sketchy) idea of the "ecology" in terms of some kind of grouping behavior for the type, at least in the wilderness. Admittedly these numbers were connected/balanced to the presence of the fighter "sweep" attack mechanic. With 2E, as the "sweep" rule became non-core, the default wandering numbers were generally reduced for hostile normal monsters (and the same in B/X), even while lair numbers were kept identical. Later editions continued to squeeze the whole idea out of the system, until the only important thing was how balanced any given fight was against the PCs, or maybe that random wandering monsters should be disposed of entirely.
How do your prefer your wandering monster number stipulations? Should each monster type have a default "ecology" in terms of its grouping in the wilderness in the core rules? Or should it be left to individual DMs and campaigns? Should the monsters appearing be based more on the monster itself, the region of the campaign, or balanced to the PCs in the game at all times?