A player's game version must be the same as the server version in order to play on that server, whether it's LAN or hosted online. If needed, you can change to another version of the game by selecting New Profile from the game launcher, then selecting the desired game version. Switching between profiles is an easy way to quickly switch your game version.
Playing on a local network
To play with someone on your network, first choose a host computer. This computer should be fast enough to play Minecraft, while running a server for other players as well. That player can create a new world, or select an existing one. Once inside that world, the host can push the Esc key, then click the Open to LAN button. Here, you can choose which game mode to set for the other players: survival is the default Minecraft, with life points and hunger, creative mode allows you to fly and place an infinite amount of blocks, and adventure mode is similar to survival, but players cannot place or destroy blocks. You can also choose whether or not to turn cheats (commands) off or on.
Once you have set these options, click Start LAN World, and you'll see a message that a local game has been hosted. Other players on the same network who wish to join can now start their game, select Multiplayer, and in a few moments their computer should automatically detect the game.
Playing on an online server
A multiplayer server allows two or more players to play Minecraft together. You can either download the server.exe file from the Minecraft website, or connect to another person’s server.
To connect to another player's server, log into Minecraft, select Multiplayer from the main menu, click the Add Server button, and enter the IP or web address of that server. If you don't know the IP of a server, thousands of public servers can be located by doing a web search for something that suits your style of play.
For general information about servers, see the Minecraft Wiki's server page. For more detailed information on setting up your own server, check out the wiki's Server Tutorials.
Playing on Minecraft Realms
Minecraft Realms is a multiplayer server service, and is purchased directly through Mojang. Setup is quick and through the game client, and allows up to ten simultaneous users. For more information, click Minecraft Realms in the game, or visit Minecraft.net/realms.