How does server hosting work?

Servers are a method of transporting data from one device to another through a shared network which both devices can access. When connected to the internet, any device can connect to any other device which has its self open to connections by port forwarding the related ports being used for that service.
Port forwarding can be thought of in a little analogy I like to tell people: think of a server as a huge wall of closed doors, on the inside is the data being stored on the server, and on the other side are people wanting to access said data. If the doors are closed, you are unable to access the data, and the server is unable to access you and your data. If a door is open, the server will be able to send and receive data through only that door.
Servers work differently depending on their purpose. For instance, the server this website is being hosted on is what's called a web server, and it does just that, serves to the web. It serves HTML documents to web browsers on ports such as 8080. Game servers are more complex and depend on the game, but they will often send important information such as player locations and world data through certain ports determined by the developers.
Hosting a server yourself can be expensive when considering uptimes, latency for potentially users, power costs and management of data and backups. Luckily, the server hosting industry has been developing for decades and there are countless options for your server hosting needs. If you need something more flexible, VPS (Virtual Private Servers) are essentially all of the functionality of a server without the maintenance, these are however, recommended for advanced administrators. If you just need a simple game server, check out my reviews of different game server hosts for games like Minecraft and Rust below.