If the government officials did not plan for your headache at 3am, you are out of luck. There is no aspirin to purchase. In fact, in socialist economies shortages and lack of selection are commonplace. The amazing thing about a capitalist system is that there is no central planner. Government officials don't tell businesses how much aspirin to produce nor the price to charge.
Private producers figure out production levels on their own.
The forces of supply and demand hold capitalist economies together. The producer supplies the product if she can make a profit by doing so. Again, the forces of supply and demand coordinate all this activity. Suppose consumers decide they do not like small fuel-efficient cars anymore. They prefer the larger 4-wheel drives.