How data is flowing on the internet?
Let's take an example, you would like to upload a picture of your last vacations on a server (whatever it is, either your own or the one of a big G), let's say that this picture is 1.4MB. In fact when you click on the upload button, it is not a full file of 1.4MB which is going through your ethernet cable but dozens... even more of little files named "data packets".
Why is your file cut into data packets?
Well, the reason is that internet cables are like a road, if there are too much traffic, then it gets stucked, you have traffic jam and that's the reason why sometimes your internet connection is getting slow. Your data packets will find the fastest road to go from point A to B, though if some roads are in a traffic jam, they may take another road in order to reach their destination.
All those packets are given to your Internet Service Provider, for example, for France they are Orange, Free, SFR, Bouygues Telecom... they are in charge of sending those packets according to the conditions they sold you a contract for, so to say, the more you pay, the best roads they are going to provide you (that's a way to say it).
Those packets are transmitted thanks to the network card that you have within your computer which is communicating with your internet box (which is somehow a computer in itself):
Public domain, https://commons.wikimedia.org/w/index.php?curid=6563540
Every data packet contains the original IP address who sent the file so as the IP destination which correspond to where the packet has to go. They contain other data in order to concatenate all the packets together at the end of the travel and make the final file.
Here is an example of those connections:
So of course, the farther the server is located, the highest the chances are that the file is going to reach its destination and be quick:
As previously mentioned all those packets are not taking the same roads, for example here, a connection from the US to access to the website of the university of Angers will pass through Germany rather than going straight to France, the website used here is https://traceroute-online.com/:
Those data packets are transferred to your ethernet cable, then to your common telecommunication cupboard if you are leaving in a flat like me:
Then they are reaching the streets under the streets:
and then crossing the oceans (if the server to reach is abroad):
This image is a screenshot from a Twitter account showing how a French company set an undersea cable.
To give you a better idea about what those undersea and underground cables look like, please have a look at the following resources: