There are many shapes and many colors of Lego elements. Some color/shapes are rare and hard to find. Why does Lego restrict the number of colors available per shape?
The problem isn't with molding machines, but with storage. Every distinct element (part/colour combination) has to be stored until it's no longer going to be used in production; presumably some are stored for spare parts and other ancillary uses.
The robotic warehouse has only a certain number of slots (a mere 0.5 million), so there's only so many different combinations that can be held at any one time. To make space for a new element, another needs to be retired - and retired plastic is wasted plastic. And waste costs money, and businesses hate that.
There's another force at play here too: pretty much every set has at least one element that is unique to that set - it seems to be not so much as a business rule, as business very firm guideline. The economic implication is that if the value of the non-unique elements in a set is $10 and the set sells for $12, it doesn't mean the set is overpriced; instead, it implies the unique element has a inherent value of $2. Harmony is restored to the LEGO secondary market. This business logic can be used to explain why licensed sets are often much worse value per brick than non-licensed - each unique minifig adds over-the-odds value. Perhaps this stretches credulity too far?
The best argument for having one unique element per set is: without a unique element, it's conceivable that someone could build this LEGO set with pieces they already own!
Few of the molds LEGO uses are running 24/7. Swapping out molds takes about three hours, during which the molding machine (one of 64) is inactive and you have expensive European labour fussing over a machine. Swapping colours, on the other hand, isn't such a big deal. Stop the plastic flow, empty the mold and remove the capture box, flow the new colour for a while until the old colour's properly flushed, then start capturing this new colour (toss all the parts molded in two colours at once into the recycling bin).
I'm hoping it's obvious why you've got to store different colours of the same part separately. I'm also hoping you can remember that LEGO makes quite a few copies of each set it sells, so that box of purple 1x4 curved slopes you see above isn't actually all that many from TLG's point of view. They have to mold every part for a given set they're going to sell, then store them all prior to assembling them in a batch. The vast bulk of LEGO is sold around Christmas, and they don't warehouse a vast amount of the completed sets (you've seen how much air is in a box of LEGO), just enough to keep the channels flowing. Basically, they've got to be able to store a good portion of the whole year's production, because they can - and do - assemble bricks into sets faster than they can be molded.
As an aside, this is why LUGBulk runs early in the year, when they know what they've got too much of lying around and are comfortable that there aren't going to be any production shocks.
Production planning is done well in advance. If a particular set turns out to be gangbuster-crazy popular and requires additional production (a recent example: Friends), LEGO can dip into its reserve of parts but the more unique a set (or even line) is, the less likely you are to have those parts in reserve. This is, in fact, an argument against having unique parts - but there's only so many models you can put a bright reddish violet slide into.
As for getting the same slide in other colours... really? You want it in Pearl light gray? In reddish brown? In tan? Remember that LEGO is sold as sets (models), and coincidentally comprises parts in various colours; if a particular part/colour combination isn't necessary to make any of the more than a hundred models marketed in a year, you're not going to see it turn up in the secondary market. Unique elements that turn up in expensive sets are going to be expensive, as those few Bricklink stores that do buy expensive sets for parting out aren't going to buy many of them.
Simply put, because each combination of part AND colour which is currently in production means that there is one machine and one mould devoted to it, and the number of both is finite.
This may be oversimplified, but that's the gist of it. Take for example the new Friends slide which is currently produced in 'bright reddish violet'. If LEGO wanted to produce it in another colour, they have two options:
The second solution wouldn't cost much, but they need to be sure they won't need it in the current colour any longer. This may very well happen, but probably not before 2015.
Again, this may be simplified, but the fact is that LEGO has a finite number of elements in production (again, part and colour) because of production reasons, and they have even been trying to lower that number. So if a designer needs something in a new colour, he has to find a good justification for it.