When you play on a server you are connected to the IP address of a multiplayer server which will enable you to multiplayer games with other people online. There are three options available:
LAN (Local Area Network)
Games are played by opening your home or local area network (LAN) to others who are also connected to that network.
Online Server
Games are played on an online server by locating and connecting to the IP address of a multiplayer server. You can either download the server file needed to set up your own server from Minecraft.net or connect to another person’s server.
Minecraft Realms
This is a multiplayer service developed by Mojang, the creators of Minecraft. This is a quick setup through the game client that allows you and up to ten friends to play simultaneously.
Note: Regardless if it is LAN or hosted online a player's game version must be the same as the server version to play on that server.