Self-assembly occurs when block copolymers are driven by thermodynamic forces to minimize free energy. The immiscible nature of the blocks causes them to phase-separate at the nanoscale, forming well-defined geometries like spheres, cylinders, and lamellae. This process is influenced by factors such as the relative length of the blocks, the overall molecular weight, and environmental conditions like temperature and solvent quality.