A cake usually collapses because it is taken out of the oven before it has finished baking inside. If the center is still liquid, it won't be strong enough to hold its own weight as it cools.
Another common cause is using too much baking powder, which makes the cake rise too fast and then sink just as quickly. Opening the oven door too early lets cold air rush in, which can shock the cake and cause it to fall before it sets.