What role do inventories play in determining the real GDP demanded?
In answering this question, suppose initially that firms are either producing more than people plan to spend or producing less than people plan to spend.
Inventory levels play an intermediary role in setting the level of real GDP demanded (which is the same thing as aggregate demand).
Let us imagine, as you suggest, a situation in which firms produce less than people are planning to spend. If we were to graph this, we would have a situation where the level of production on the short-run aggregate supply curve (SAS) would be lower than equilibrium. (Look at the graph in this link to help you visualize this.) This would mean that the price level would be below equilibrium and there would be a higher quantity demanded than supplied.
In this case, firms’ inventories would quickly run down. People would buy everything relatively quickly and inventories would run out. This would serve as an intermediary or a transmitter to signal that companies should produce more goods. As they produce more goods, their costs will rise due to such things as the law of diminishing returns. This causes the price level to rise until equilibrium is reached.
In the opposite case, firms produce too much. Inventories rise and do not fall. This leads to a drop in prices to clear inventory. This continues until equilibrium is reached.
In both cases, inventory levels act as a signal or an intermediary, letting firms know whether to increase or decrease production and thereby helping to determine real GDP demanded.