Delve into the intricacies of geotechnical engineering by examining the factors affecting soil stability and their implications on foundation design, encompassing aspects such as soil composition, moisture content, and geological formations.