It is often taken for granted that rivers organize transport into a single active channel. In some net-depositional environments, however, flow of water and sediment is distributed in several stable channels. Such branching rivers may be confined in valleys (anabranching or anastomosed) or unconfined on deltas (distributaries), and their existence confronts us with the very basic question of what governs the spatial organization of channel patterns in sedimentary landscapes. Current models for equilibrium channel morphology cannot predict the occurrence of branching rivers because they do not consider dynamical processes such as avulsion, i.e., the rapid abandonment of a channel in favor of a new path at lower elevation. The requisite conditions for avulsion have been the subject of ongoing debate. Here we resolve the conditions leading to channel avulsion, and show that branching rivers occur when avulsion is the dominant mechanism of lateral channel motion. A compilation of field and laboratory data demonstrates that avulsion frequency scales with the time required for sedimentation on channel beds to produce a deposit equal to one channel depth. From the relative rates of bank erosion and channel sedimentation, we derive a dimensionless mobility number that accurately predicts the conditions under which anabranching and distributary channels occur. Results may be directly applied to modeling landscape evolution over human and geologic time scales, and for inverting formative environmental conditions from channel deposits on Earth and other planetary surfaces.