Broadly speaking, foundations can be classified as shallow or deep. Shallow foundations are used when the bearing capacity of the surface soil is adequate to carry the loads imposed by a structure. On the other hand, deep foundations are used when the bearing capacity of the surface soil is not sufficient to carry the loads imposed by a structure.
So, the loads have to be transferred to a deeper level where the soil layer has a higher bearing capacity.
Pile foundation, a kind of deep foundation, is actually a slender column or long cylinder made of concrete, steel or timber. They are principally used to transfer the loads from superstructures, through weak, compressible strata or water onto stronger, more compact, less compressible and stiffer soil or rock at depth, increasing the effective size of a foundation and resisting horizontal loads. They are typically used for large structures, and in situations where soil is not suitable to prevent excessive settlement.