How does a pure market economy answer the basic question of which goods and services should be produced?

The government decides what should be produced.
Producers decide what should be produced.
The law of supply and demand drives this choice.
Consumers decide what should be produced.

In a pure market economy, the law of supply and demand drives the choice of which goods and services should be produced. Producers will produce goods and services that are in demand by consumers, as they will be able to sell these products at a price determined by market forces. Therefore, the preferences and choices of consumers ultimately determine which goods and services are produced in a market economy.