It's a complex question and you can model it in many ways based on different assumptions etc. However, if want to go with the traditional economic idea:
People have internal utility functions that provide an internal value. They can also guess how other people value a good and if that's higher than their internal value they might buy it with the intent to profit. It's the second line of thinking that can create bubbles, but it's a finite world with finite resources so over time speculators tend to run out of money at which point market price tends to go back a market price based on an internal value of people who actually use the good and the cost of production.
It's odd to think of people being more rational in the long term, but rational ideas are simply more stable.
It's just a toy model... but that does underscore how easy it is to come up with a set of assumptions that lead to irrational ideas being more stable than rational ones.
That model uses an incorrect mapping between beliefs and actions to correct for the 'incorrect' beliefs. As long as the internal model map's correctly to the external world it's correct. It's logically the equivalent of someone acting normal for fear the invisible elephants who secretly run things will eat them.