How to join a team in minecraft?

Solution 1:

In order to join a team the team in question must already exist.

First create a team (or more):
/scoreboard teams add <name> <display_name> (display name is optional)

You can as well list your current teams to check what's already there:
/scoreboard teams list

And if you use the list command with a team name you can check what players are on that particular team:
/scoreboard teams list <name>

If you have your teams you can then finally add entities to them...
You can use selectors [@a, @p,..] for the entity or even leave it blank (in that case the executor will join the team)
/scoreboard teams join <name> <entity>