(There is a rather complete Wiki-article about)
While it is not used as much nowadays,
Still widely in use, just not so much with fine electronics.
then passing the board over a standing wave of solder.
It's rather the edge of a 'solder-fall', but there were various designs over time.
How does the stuff know it is supposed to only stick to the components?
Solder isn't a glue, but joins by diffusing into the surface of another metal (*1,*2), thus it doesn't stick to anything. So it does not stay on a PCB just by touching it. Old radio boards (but even early computer boards, most notably SWTPC or OSI) are made that was. quite visible by having 'thick' and 'round' traces.
To avoid solder on such and parts that should not carry any, a solder mask is used. That's essentially a layer of lacquer printed on top of the traces, wherever no solder needs to go. It also helps increasing fine details
In addition the PCBs are preheated, so the solder moves in right away. Naturally the traces heat better than the PCB. In fact, heating (degree and speed) - and later cooling - is a major part of making a wave soldering work.
I don't know whether this technology has changed significantly over the decades,
It did, but that doesn't matter much.
*1 - That's what soldering is about, melting just one of the metals. In contrast to welding were both sides (usually the same metal) that get melted and crystalize again in a unified area - and no, sintering is again different, but brazing is essentially the same a soldering.
*2 - It's not any 'metal', but a specific one. Solder is especial formulated to interact at a certain temperatures with a certain metal.