Coherent vortical motion has been reported in a wide variety of populations including living organisms (bacteria, fishes, human crowds) and synthetic active matter (shaken grains, mixtures of biopolymers), yet a unified description of the formation and structure of this pattern remains lacking. Here we report the self-organization of motile colloids into a macroscopic steadily rotating vortex. Combining physical experiments and numerical simulations, we elucidate this collective behaviour. We demonstrate that the emergent-vortex structure lives on the verge of a phase separation, and single out the very constituents responsible for this state of polar active matter. Building on this observation, we establish a continuum theory and lay out a strong foundation for the description of vortical collective motion in a broad class of motile populations constrained by geometrical boundaries.