Bad investments occur all the time, but when they occur massively like in an boom-and-burst, that's because something interfered with prices, making people take decisions they otherwise would not. (if prices were a correct indicative of supply and demand).
The major cause of such massive bad investments today is cheap credit created through inflation. Central banks create new money and buy debt bonds with it. Buying debt is the equivalent of lending. They increase the supply of money available for lending, without any actual increase in savings (resources, not money). With this cheaper credit, people will make loans they otherwise would not, and investments that wouldn't take place spontaneously now happen. These investments will not have the amount of actual resources they need to complete - remember, only new money was created, that doesn't magically create resources as well. When these investments start to fail, people will "realize" their lost. The actual lost happened when resources were wasted on investments that were not worthy it.
In the example of the $5 million house, if somebody paid that price for it, it means he traded much more resources (the results of his labor) against this house than s/he needed to. That's the lost: you worked much more than you needed for the house. All that work was wasted (lost).
As I explained above, the actual lost did not happen during the crises, it happened before, during the boom, when resources were being wasted on bad investments. The crises is the moment when people realize their mistakes. And the recession is the period in which society as whole reorganizes itself, mainly the capital structure. For example, in this particular real state crisis, too much capital and labor was directed towards real state building. Such capital and labor must be reallocated to activities that better suits society's more urgent needs. This reallocation is never easy: neither capital (means of production) nor people can easily change functions - some times they just can't. So, during this time, there will be poverty, unemployment and so on. And the total production capacity of society will probably be smaller, since lots of capital will be lost, as well as labor.
Hope I've made it clearer instead of even more confusing.

That's a great view, I think most of the economy schools are taking this view, academically it is quite nice
I have a different view
When people sell product and get money, they save the money, but they did not save the value (the product was consumed or degraded), money was hold as a "proof of work"
It's easy to see: Saving do not increase the society's consumable resource, it just increased society's "proof of work"
So, in the example of the $5 million house, A paid B $5 million to buy the house, there are $5 million worth of "proof of work" transferred from A to B, but the real wealth is only that house, those $5 million worth of "proof of work" do not correspond to enough tangible wealth in the society
Same house could worth 5 million one year and 3 million another year, but the house do not change, only the exchange value of the house changed