A computer system or any SOC (System on chip) device with network interfaces uses routing tables to connect to other networks. A routing table is system wide (tabular) configuration which take cares how the IP packets would be send to another system.
Usually, every network device (laptops, routers, switches) has routing table configured manually or automatically.
At a ubuntu machine, routing table looks something like below. Every entry says which Interface (Iface) would be used to send an network packet with certain IP. The machine in the snapshot has two network interface (eth0 & tun0).
The default route (0.0.0.0 in windows) is used for all the non-matching IP , i.e, All the internet traffic goes via default interface. A windows routing table looks like below.
You can add a new route (static routing) to windows machine using route ADD command. (You need admin privilege ).
route ADD 184.108.40.206 MASK 255.255.255.0 192.168.0.191
Now, if you ping 192.168.173.1, it would be routed to interface having IP address 192.168.0.191). The interface would further transfer the packet to its default gateway.
You reach internet server via multiple gateways, switches and routers. All of them have a routing table configured. Windows trace route command can tell which systems have been used to reach the internet server.