Aggregation occurs due to several mechanisms, including van der Waals forces, electrostatic interactions, magnetic forces, and depletion interactions. In a liquid medium, factors like pH, ionic strength, and temperature can also influence aggregation. For instance, changing the pH can alter the surface charge of nanoparticles, leading to either stabilization or aggregation.