Aren't there other factors like uniqueness, doability? I just want to know exactly what are all the factors for choosing a character.
Those are all factors that go into it. Importance, relevance, uniqueness, feasibility of course. It's not really an exact science though. These factors can fluctuate from one series to another. It's a case by case basis for every character.
First parties will always be more feasible than third parties on the simple fact that they're characters Nintendo already owns themselves. None of the legal hoops to jump through like with third parties.
Relevance in Mario is different than in series like Pokemon and Fire Emblem. The former generally always uses the same cast; Mario and Luigi as the playable heroes, Bowser as a villain, Peach a damsel/supporting role/occasional playable role. The latter two have a unique cast of characters in each game. Each game has it's main protagonists/villains, but these are different and ever changing from game to game unlike Mario or Zelda where you can always expect Mario and Link.
Uniqueness is quite important too. That's what gave Ice Climbers the edge over multiple other retro characters. And that said, they weren't relevant either, but the unique idea Sakurai came up for them was enough to warrant their inclusion. They're also an example of feasibility. They take a lot of work, but were doable in Melee and Brawl, but were cut in Smash For due to issues with the 3DS version.
Many, many factors go into it, but these factors aren't quite the same for every situation. I probably didn't do a very good job explaining that, but hopefully some of it helps.