In the context of civil engineering, what are the primary factors that contribute to the occurrence of differential settlement in structures, and how can engineers mitigate these effects during the design and construction phases?