The Wisdom of crowds. The Madness of crowds

One of the favourite mantras of the techno-optimist is that “the wisdom of crowds will save us.” That with a million collective inputs, we will find solutions that make the world a better place. Is this true? Why is it that wisdom and not madness is the state of crowds? There are too many examples of foolishness in crowds. I don’t think we can have the wisdom of crowds without their madness.