Amazon's business model relies on automation to achieve the highest possible efficiency in filling orders - optimizing both inventory and overhead, and focusing on transaction volume across a distributed network of fulfillment centers. They are also extremely good about customer service, hence their very fast order fulfillment time, and the fact that customers rarely have to wait for a backordered item.
If I had unlimited resources and were challenged to build a system to compete with Amazon, I would think in terms of centralized ordering and inventory tracking, so that any time an order is placed, that centralized system would immediately know which fulfillment center has the items, and in what quantity, and would instantly issue a command that instructs the necessary fulfillment centers to ship the items that have been ordered. And if I were really clever, I would also make that system smart enough to select a fulfillment center that is closest to the customer in order to minimize shipping time and cost, and that would also be able to divert orders in real time to react to temporary, Act-of-God disruptions at specific fulfillment centers.
And I would also probably create a process of tracking the rate at which individual items are ordered, with the objective of trying to maintain enough inventory at the fulfillment centers to meet the typical quantity included in the average order. But having said that, I can understand that when items are packaged individually, all it takes is for the last order for an item to request a non-typical quantity to result in a fulfillment center not having sufficient quantity of an item to meet the next order.
That would fall under the heading of 's--t happens'.