Massive stars influence the surrounding universe far out of proportion to their numbers through ionizing radiation, supernova explosions, and heavy element production. Their formation requires the collapse of massive interstellar gas clouds with very high accretion rates. We discuss results from the first three-dimensional simulations of the gravitational collapse of a massive, rotating molecular cloud core that include heating by both non-ionizing and ionizing radiation. Local gravitational instabilities in the accretion flow lead to the build-up of a small cluster of stars. These lower-mass companions subsequently compete with the high-mass star for the same common gas reservoir and limit its overall mass growth. This process is called fragmentation-induced starvation, and explains why massive stars are usually found as members of high-order stellar systems. These simulations also show that the H ii regions forming around massive stars are initially trapped by the infalling gas, but soon begin to fluctuate rapidly. Over time, the same ultracompact H ii region can expand anisotropically, contract again, and take on any of the observed morphological classes. The total lifetime of H ii regions is given by the global accretion timescale, rather than their short internal sound-crossing time. This solves the so-called lifetime problem of ultracompact H ii region. We conclude that the the most significant differences between the formation of low-mass and high-mass stars are all explained as the result of rapid accretion within a dense, gravitationally unstable flow.