Firstly, like many large, sophisticated companies, they aren’t a one trick pony. They have a massive portfolio of technologies and products; this means that they will often misstep, but for every minor or major failure there is another minor or major success to compensate. They absolutely have a portfolio approach where they expect some failures.
In terms of failures, there are a couple more defining characteristics: They are internally complex and there are frequently internal silos and cross-team barriers or rivalries. This can produce organisational disfunctions that leads to mistakes. Again this is common in large organisations. also they are deeply a technology company (Bill Gates legacy), not a consumer company. Their product marketing is adequate at best and they largely do not have the culture to be successful in the consumer space - most of their headline failures are where they have misunderstood the consumer. Their success in business and, in the last decade or so, large enterprise offsets this and reminds us that they can’t be good at everything. (Amazon is the only company I know that manages to be good at enterprise and consumer).
Back to reasons for success. As others have stated, they are massively rich and this allows them to weather the storms they create.
They are amazingly agile for a large company. “Turn on a dime” could be their mission statement. They are often late to market, but when they re-align they do it well and with commitment.
They aren’t afraid to pull the plug. personally, I loved Windows Phone, as an example; technically it was the most sophisticated mobile OS I have seen, the UI was very good and the vision was impressive. However they couldn’t make it fly (see reasons above) and couldn’t get the app makers on board. So they killed it. Completely. It failed, not for technical reasons but for commercial ones. So they re-aligned their strategy; rolled with it, learned and moved on, without shedding too many tears.
They are honest. While they are not short of flaws and a patchy history, the Nadella Era Microsoft is culturally impressive. It’s very ethical, doesn’t treat its customers like products and really takes security, privacy and ethics seriously.
They also have an amazing R&D programme, staff who are looked after (though they also are expected to deliver a lot) and a huge portfolio of patents and developments.
TL:DR Microsoft is agile, broad and has great leadership under Nadella.