Explore the theoretical underpinnings of soil mechanics and its significance in foundation engineering. Discuss the principles of consolidation, bearing capacity, and settlement analysis, highlighting their importance in ensuring the stability and longevity of structures.