A longer vertical that squeezes the same power into a flatter pattern. Gain does not come from nowhere: the antenna sends less energy up at the sky and more toward the horizon, where the other station is. The two common ways are a single 5/8-wave radiator and a colinear, a stack of half-wave sections.
The 5/8-wave whip
Side view, equal power. The 5/8 wave sends more signal toward the horizon, where the other station is.
A longer radiator concentrates the radiation. A ¼ λ whip puts its strongest signal at the horizon and spreads the rest up into the sky. At 5/8 λ the elevation pattern is flatter and low, so more energy reaches the horizon for the same power. That is roughly 3 dB on paper, over a perfect ground plane. Much longer than 5/8 λ and a lobe appears at higher angles, which is why 5/8 is the usual stopping point for a single element.
A 5/8 λ element is not resonant by itself: it looks capacitive at the feed point. A small loading coil at the base cancels that and sets the impedance; the exact coil depends on the design. It still needs a ground plane or radials, and the gain disappears if they are poor.
Colinears
Blue curves show the size and direction of the current along each half-wave section: curves on opposite sides mean opposite directions.
Simply joining two half-wave sections end to end does not add gain: the current reverses at the junction, so the radiation from one cancels the other's. A phasing coil (or a loop or stub) between them flips the upper current into step with the lower one. The two sections now radiate together, and the pattern flattens further. Three or more sections work the same way.
Trade-offs
Height. More gain means a taller antenna and a flatter, narrower elevation pattern.
Overshooting nearby stations. A very flat pattern can send energy over the heads of stations that are close or far below the antenna, such as in hilly country. A short, low-gain antenna can serve them better.
Check the units. Manufacturers quote gain in dBi or dBd, and the two differ by 2.15 dB; see Gain and directivity.
Ground still matters. Gain figures assume a good ground plane, or a vehicle roof. A poor one can cost more than the extra length gains.