Foundation types are chosen based on subsurface soil conditions and the structural requirements of the building. Shallow foundations are used for structures with moderate to low loads bearing on soil with sufficient capacity. Deep foundations like piles are used when soil capacity is low or non-uniform. Raft or mat foundations spread loads over a large area and are suitable for heavy loads or poor, variable soils. The type of foundation must effectively support the structure while addressing issues like groundwater level, soil composition, and potential settlements.