This only just occurred to me, so please pardon the lack of development of what is, after all, a rather obscure thought for a general purpose blog.
Without getting into comparisons between mammals and fish, amphibians, or reptiles, some of which lay many eggs at once, or with birds, some of which lay eggs frequently, there's what may be an interesting comparison to be made between mammals and our closer cousins, the marsupials, who are very much like mammals except that they carry and nurse their young in pouches, from a very early stage of development.
A pouch might be considered a built-in, portable nest, and as such a considerable convenience, but far more so with small litters than with larger ones. Much the same is also true of a womb, since a mammalian mother is burdened not only with the weight of her young but also with that of the placenta and amniotic fluid, until they are born, and larger mammals also tend to have small litters.
However, most mammals don't habitually carry their young around with them continuously, once they are out of the womb. It's common for mammalian mothers to leave their litters in some safe place for short periods of time, long enough to find something to eat, to maintain lactation, so their young can continue to develop to the point of being able to move about on their own and take care of themselves. There are plenty of exceptions, of course, but species which take advantage of this pattern, hogs for instance, can have quite large litters.
How is having large litters an advantage? It isn't necessarily, certainly not if it means that you overrun your resource base (food), but if your young are on the menu for other species a large litter can help to insure that a few survive. Also, in the case of predators such as members of the dog family, dependent on prey species with highly volatile populations, the ability of have larger litters can help your own population track that of the available prey more closely, and prevent the situation where they become so common that they eat themselves into a crash condition.
So how did the marsupial pouch develop in the first place, if the combination of live birth and nesting provides a more flexible selection of strategies with an overall advantage. Maybe, just maybe, at the time that both mammals and marsupials were first getting started, about the same time that dinosaurs were just coming into their period of dominance, there was seldom any such thing as a safe place, and nesting was perilous.
Like I said, it's an obscure thought. Don't try to wring more from it than is there.