Cakes that sink in the middle after being taken out of the oven often do so because they have not completed baking. Until the cake's structure has time to develop fully, the center of the cake is not strong enough to support the top of the cake. This is due to the outside of the cake forming prior to the inside.
A cake will sometimes fall in the center while baking if the oven door is opened during the baking process, allowing the heat to escape. The cake stops baking briefly, which causes the heat inside the cake to escape and the top to fall.
There are a number of signs to look for in a cake that is completely baked, including pulling away from the edges of the cake pan, looking risen in the center of the cake, skewers or toothpicks coming out clean when inserted into the cake and cakes that spring back easily when touched.