Character unlocks differs between the 3DS and Wii U versions. I'm posting a complete list for both versions below. Source
Ness
3DS: 10 Smash matches or beat Classic mode
Wii U: Unlocked by default
Falco
3DS: 20 Smash matches or beat Classic mode without using any continues
Wii U: 10 Smash matches or beat Classic mode
Wario
3DS: 30 Smash matches or complete 100 man smash
Wii U: 20 Smash matches or complete 100 man smash
Lucina
3DS: 40 Smash matches or beat classic mode as Marth without using any continues
Wii U: 30 Smash matches or beat Master Core (classic mode final boss at intensity 5.1 or greater) as Marth at 5.5 intensity
Dark Pit
3DS: 50 Smash matches or beat Classic mode with three or more characters
Wii U: 40 Smash matches or beat All-Star mode on Normal
Dr Mario
3DS: 60 Smash matches or beat Classic mode as mario at intensity 4.0 or greater
Wii U: 50 Smash matches or beat one Master Order on hard difficulty
R.O.B.
3DS: 70 Smash matches or collect 200 trophies then play a Smash match or beat classic mode
Wii U: 60 Smash matches or defeat Crazy Hand after completing 10 matches in Crazy Orders
Ganondorf
3DS: 80 Smash matches or beat Classic mode as Link at intensity 5.0 or higher
Wii U: Unlocked by default
Mr.Game & Watch
3DS: 90 Smash matches or beat Classic mode with ten fighters
Wii U: 80 Smash matches or beat Classic mode with five fighters
Bowser Jr
3DS: 100 Smash matches or beat Classic Mode as Bowser on Intensity 6.0 or higher
Wii U: Unlocked by default
Duck Hunt
3DS: 110 Smash matches or beat Classic Mode with 8 or more characters
Wii U: 100 Smash matches or KO one fighter in Cruel Smash
Jigglypuff
3DS: 120 Smash matches or collect 30 different equipment items
Wii U: Unlocked by default
DLC Characters
Mewtwo
3DS: $3.99
Wii U: $3.99
Both: $4.99
Lucas
3DS: $3.99
Wii U: $3.99
Both: $4.99
Roy
3DS: $3.99
Wii U: $3.99
Both: $4.99
Ryu W/ Suzaku Castle
3DS: $5.99
Wii U: $5.99
Both: $6.99
(Note: This DLC comes with the stage as well as the fighter)
Cloud W/ Midgar
3DS: $5.99
Wii U: $5.99
Both: $6.99
(Note: This DLC comes with the stage as well as the fighter)
Corrin
3DS: $4.99
Wii U: $4.99
Both: $5.99
Bayonetta W/ Umbra Clock Tower
3DS: $5.99
Wii U: $5.99
Both: $6.99
(Note: This DLC comes with the stage as well as the fighter)
Best Answer
Consider the following:
Say "Team Red" has three characters: Charizard, Mario, and Ike. "Team Blue" also has three characters: Mega Man, Sonic, and Lucario.
Every time you play as one of those characters and you win, you add a couple of points to that character's team (you can see how many points you contribute on the results screen after the fight where you used the character, indicated by a flag). The server adds up everyone's points contributed, and it generates a percentage, which is how the server decides which team wins. For example (again):
Say you fight and win four fights: one as Ike, one as Lucario, one as Pac-Man, and one as Mario. You'll contribute (let's say) 7 points to the Red Team by winning as Ike the first time (I don't know how much exactly), 7 points to the Blue Team by winning as Lucario, no points to no team for winning as Pac-Man, and another 7 points to the Red Team for your Mario victory.
Now, if you were the ONLY person in the world who played SSB online, the Red team would win because you contributed 14 points to the Red and 7 points to the Blue.
As for the prizes, you're right. It's all random. Realistically, millions of users play SSB online, so there would be no easy way to evenly dole out prizes among everyone. It's just like random classic mode victory prizes (or pretty much anything else).