2 ways:
Wired through LAN cable i.e. Ethernet. connect all PCs to the router with a lan cable.
Wireless using wifi to connect to the router.
I once called up all my friends to play online. 3 of us hooked up wirelessly and one had to use the LAN cable coz he couldnt connect for some reason. However all 4 of us could play online and also against each other.
Setting the multiplayer game depends on the individual game and usually involves creating a server yourself or joining an online public server.