Short answer
The visible spectrum is the narrow band of electromagnetic radiation the human eye responds to — very approximately 380 to 700 nanometres. Within it, wavelength varies smoothly and continuously; the familiar rainbow bands are names we impose on a gradient, not divisions that exist in the light itself.
Electromagnetic radiation spans from gamma rays measured in fractions of a nanometre to radio waves measured in metres. Visible light occupies a sliver of that range, conventionally given as about 380–700 nanometres, though the boundaries are soft: sensitivity tails off gradually rather than stopping, and varies between individuals and with age and light level. Longer wavelengths just beyond the red end are infrared, felt as heat rather than seen; shorter wavelengths beyond violet are ultraviolet, which the human lens largely blocks but which many insects and birds can see.
Running from long to short wavelengths, the spectrum passes through red, orange, yellow, green, cyan, blue and violet. Those names describe regions, not segments: there is no wavelength at which orange stops and yellow begins, and no physical marker separating them. Where people draw the lines varies by language and culture — several languages historically treated blue and green as one category, and the familiar seven-colour rainbow owes as much to Newton's wish to match the seven notes of a musical scale as to anything in the light.
This is why two people can genuinely disagree about whether a shade is blue or green without either being wrong.
The spectrum contains only the colours produced by a single wavelength. That leaves out a great deal. Pink, magenta, brown, grey, white and every unsaturated colour arise from mixtures, or from a colour's relationship to its surroundings, and no wavelength corresponds to any of them. The set of colours humans can see is therefore much larger than the set of spectral colours — the spectrum is one edge of the space, not the whole of it.
A rainbow appears when sunlight enters a raindrop, refracts, reflects off the back and refracts again on the way out. Different wavelengths bend by slightly different amounts, so they emerge at slightly different angles and the mixture is spread out into its components. The bands are broad and blurred because each is produced across a range of angles and because the sun is not a point source — which is why a rainbow never shows the crisp edges a diagram suggests.
Wavelength ranges and perceptual thresholds are given as approximations: both vary between individuals and with viewing conditions, and sources differ on exact boundaries. Where a figure is contested or unavailable, this page says so rather than picking one.