This is a process that is very involved and complicated and its difficulty of execution can depend on the extent of the damage to the foundation, the overlying structure and its location and present conditions that are affecting the soil below the foundation. You will require to appoint technical experts who can analyze the situation and understand all the causes and reasons for the foundation failure, and then suggest the steps that can be undertaken to replace the foundation. In such case, the utilities in the home need to be turned off, and the home may need to be lifted a few feet above its foundations so that sufficient space is created for putting the new foundation in place. It may at times require the earth below the foundations to be recompacted, or piles to be inserted, that can then be joined together with the new foundation on which the home will now rest. The home can then be lowered on to its new foundations, utilities reconnected, and any repairs to walls and other parts of the building carried out.