The free market participants understand where money should be allocated beause they are the ones that are creating the demand.
Yes, exactly. This relationship is as fundamental as self adjusting population balance in the animal kingdom (ie wolf and rabbits), as obvious as supply and demand, as omnipresent and unavoidable as is the attractive force between two masses, etc. A completely free market
will adjust itself due to its self-sustaining nature; a vacuum in demand will be filled and any excess of demand will be trimmed. Any fundamental law of the universe, however simple, cannot be disputed, including the one you mentioned above. The beauty and simplicity of this law is what makes Libertarianism so appealing. HOWEVER, to stop the thought process at that alone ignores the very critical variable that render these laws imperfect; humanity. Namely, our need for survival and the fact that through millennia we discovered that a community is best to achieve this.
A wolf/rabbit population balance ignores the deaths of both species during the adjustment process because it is irrelevant to both nature and us. But replace the wolf and rabbit with, say, wolf and human than the deaths of humans become unacceptable. The natural relationship which would have corrected itself if one population became too large is no longer apt. The failure of Libertarianism does not lie in its economic idea (because they are mathematically obvious), rather in a neglect of the consequences of its means of its operation.
Lets dismantle the FDA, for example. Corporate America no longer have massive government mandates on work shop cleanliness, no mandates on import inspections, no mandates on the minimum test samples required, etc. Company A decides to drastically lower their food inspection prior to shipment. An outbreak occurs and and as a result some people die. Company A is now ruined. Company B comes in with a new and more efficient corporate structure which allows for great quality inspections. Company B thrives.
Are we to ignore the deaths of those folks? If so, then yes; let ultimate free-market thrive. However, you effectively negate the need of any and all government because the creation of the FDA, the EPA, even smaller arms such as the New York City Buliding's Inspectors division, were made ESPECIALLY because of critical failure of Libertarianism when it comes to human health and rights.