As animals navigate their environments, their nervous systems transition between a wide range of internal states that influence how sensory information is processed and how behaviors are generated. These states of arousal, motivation, and mood can persist for hours, play a central role in organizing human behavior, and are commonly disrupted in psychiatric disease. Although virtually all animals organize their behavioral outputs in this state-like fashion, the neural mechanisms that underlie the generation of these states remain poorly understood. In this talk, I will present our progress in deciphering neural mechanisms that generate these states, with a focus on the involvement of the distributed neuromodulatory systems that control the brain’s state. Our studies are being performed in the nematode C. elegans, where we can apply cell-specific genetic tools to monitor and perturb neurons throughout a nervous system whose ground-truth connectivity is known. By studying how this organism switches between a range of distinct behavioral states, we have uncovered mechanisms of behavioral state generation that bridge scales of analysis: identifying molecular mechanisms that allow the gut to signal to the brain to activate neuromodulatory systems; defining how neuromodulator release alters ongoing neural circuit dynamics and behavior; and relating the molecular and anatomical organizations of neuromodulatory systems to their functional roles in generating behavioral states. We envision that these studies will ultimately reveal fundamental principles of neural circuit function that will generalize across animals.