Online play lets players go head to head against other players around the world. When partying with a friend(s), it will always assign you to the same team. If a player leaves early, an AI will fill their place until a new player is found to take their place; so it is possible to be queued into a game already in progress (*when players leave ranked matches, there is no replacement). As of patch v1.04 (Aug 11, 2015), players now have the option to vote to forfeit matches and the option to spectate matches.
At the end of each game, there is a 1 minute grace period between rematches that will end early if all players hit ready. Voting to 'Rematch' will put all remaining players on the same teams as before, where otherwise the player teams can be shuffled. Players in a party will always be on the same team when finding a match.