We know the network game modes can be a little confusing, but here's a quick summary of them and how they work.
At their core, they all work the same way, with the difference in how the connection endpoint is discovered.
The simplest mode is Direct Connection. All the other modes are based on this one. With Direct Connection mode, the Host* (the device running the game) listens for TCP/IP connections on a specific port. To connect, a Guest has to enter the IP address and port number of the game running on the Host, and their game will connect directly to the Host.
In LAN Multiplayer the Host again listens for TCP/IP connections on a specific port. It also broadcasts/multicasts an advertisement for the game on the local network. Guest devices listen for these advertisements, and display the information. Selecting an advertised game and connecting to it uses the IP address and port number contained in the advertised game instead of requiring those be entered manually.
Similar to LAN Multiplayer, the Host listens for TCP/IP connections on a specific port number. The advertisement of the game is sent to a web server rather than over the LAN and a game code is assigned. Guest devices connect to the web server to ask for the game's details using the game code, and then connect using the IP address and port number contained in that information instead of requiring those be entered manually.