Magmatic differentiation is the process by which a single, chemically homogeneous parent magma evolves — without any external addition of material — into two or more magmas (and, ultimately, rocks) of different composition. It is why a single mantle-derived basaltic parent magma can give rise to a compositionally zoned suite of rocks ranging from basalt through andesite to rhyolite within one magmatic system.
Physical processes driving differentiation
Fractional crystallization — as a magma cools, minerals crystallize in a systematic sequence (the Bowen reaction series) and are mechanically removed from the remaining liquid, usually by gravitational settling of dense early-formed crystals (e.g. olivine, Cr-spinel) to the base of a chamber, or occasionally by flotation of low-density crystals (plagioclase in some tholeiitic magmas). Because the crystals removed have a different composition than the bulk liquid, the residual liquid is progressively driven toward more evolved (typically more silicic, more Fe-enriched or more alkali-enriched) compositions.
Crustal assimilation (contamination) — a rising or ponded magma partially melts and incorporates wall-rock material, shifting its bulk composition toward that of the assimilant (frequently combined with fractional crystallization as "AFC," assimilation-fractional-crystallization, because assimilating cold country rock consumes latent heat that is supplied by simultaneous crystallization).
Liquid immiscibility — under certain conditions (e.g. Fe-Ti-rich tholeiitic liquids late in crystallization) a single silicate melt can unmix into two physically separate, coexisting liquids of markedly different composition (an Fe-rich and a Si-rich liquid), which then evolve and may segregate independently.
(A fourth recognized mechanism, volatile/gaseous transfer — the preferential partitioning of volatile-soluble incompatible elements into an exsolving fluid or gas phase that then migrates through the crystal mush — is also commonly cited but was not required to answer the three requested here.)