The tale of Windows Phone is one of absolute hubris. Let me tell you the ways.
Microsoft thought, just by planting a guy to make Nokia move to WP, they could steal Nokia's exceedingly loyal users. But those people were not blindly loyal to the brand, they were invested in the roadmap: Symbian now, MeeGo soon. Without these, might as well go a completely different way. Especially when many were angry for the loss of MeeGo.
Ditto about carriers and app developers, who were counting on that roadmap. They had put a lot of money and work in preparing for MeeGo. The move to WP cost them a lot, so they were enraged and went with anyone but Microsoft.
The Skype acquisition didn't help either. Calls and messages for free? Carriers saw it as an existential threat. Microsoft got promoted from "those people are a headache" to "those sons of bitches are actively trying to murder us".
And WP may be decent now, but it was originally rushed. When the first Lumias came out, it was an incomplete mess without a possible upgrade. This meant lots of returned phones, a headache to retailers. So they also hated WP and discreetly guided potential buyers to a less headache-inducing alternative.
Microsoft was so sure they could buy success, they ended up stepping on everyone's toes.