TL;DR:
- the OS maintains a hash map mapping port/IP/protocol/protocol-version to lists of sockets
- there's a scoring algorithm that determines which socket wins, based on specificity of how the socket(s) were bound
- if multiple sockets are bound with SO_REUSEPORT, things are routed based on a hash of the source/destination address/port, presumably so packets from a single client aren't split between different handlers - essentially, simple zero-backpressure load balancing
- read the article for nuances of when and how to use this, especially performance considerations about pre/post fork
- consider adding TL;DR segments like this, whether you're writing discovery fiction like the OP, or technical deep-dives like the link in this comment. Different readers will prefer different formats, but everyone benefits from having the option to consume an abstract before reading lengthy nonfiction prose!