Right time, right place, right people on the team and whatever other circumstances you might want to describe as "luck" play a much bigger role than people like to admit because it would diminish their own accomplishments.
Also his and Microsoft's success has less to do with how much and how great Mr Gates can code; just think of Steve Jobs and many others. Good techs don't necessarily make for successful CEOs - quite the opposite is just as plausible if not likely considering how techs typically detest politics.