In a market system, the "What will be produced?" question is ultimately decided by the profitability of products. Companies compare products profitability to decide which product is to be produced. The major goal of a company or business is to maximize profits, hence its production decisions are also based on the profitability of products.
Hence the answer is the profitability of products.