Explain the minecraft server system?

Can anyone explain the minecraft PC server system?
Me and my two friends are in the process of purchasing the game, and I was wondering how the servers worked and how we'd be able to play with one-another.
We want to have a private server where we can just mess about in, and i'm assuming the only way of doing that is through web hosting? Or are there private servers within the game itself?
What about a single-player type mode?

Out of other server set-ups Minecaft servers are easy.
Before reading this please have basic technical knowledge.

You can both play Minecraft on a server together and you could host it on your computer for free but only you could connect to it. For anyone in the anywhere on earth to connect to it you need to port forward it.
I'm not going to explain how to port forward and create servers on here because it is different for every router but, there are many ways on YouTube on how to make a server and port forward it so other people can join it from different internet routers.

If both of you use the internet from the same router you don't need to port forward, all you have to do is go on a single player world you and your friends would like to play on then click Esc to open the menu then click Open to LAN then your friend's (Using the same Wi-Fi) should find your singe player world appear in the server button on the main menu.

There's also a private server hosting made by the creators of mojang themselves but it cost at least 7$ a month for it and it is only available for people in Sweden and all the people that went to Minecon ( at the moment it is but it will eventually be released across the world.)

If you don't want to port forward you could just get a online 24/7 server host at a monthly cost and they would give you the ip to connect to for the server.

Please if you have any questions just reply if that is possible on here…