They lost because finding good Windows Phone apps was difficult. This is why I stopped using a Windows Phone, and why everyone I know stopped using a Windows Phone.
I could pick up a performant Windows Phone for $40, and I wasn't happy with my Android until I spent $200+.
Not to mention one of the largest companies in the world right now makes most of it's money off of selling a mobile OS's.
Handset was cheap, performant, the OS was gorgeous and easy to use, typing was great.
It's weird though. The apps are totally what did it, but I've found that I really don't use many apps on phones. My phone is littered with the, but my usage statistics say that I'm a slack ass when it comes to them. Basically just language applications.
Trying to compete in a new market against free was a much harder prospect (and they where not the only one, I had a Blackberry Playbook, it was for it's time an excellent device and the OS was intuitive and solid...it got murdered in the market).
In fact unless you invent the category (iphone) you would be hard pressed to own it via the OS anymore.
So the mobile OS layer is where MS use to make money and it's what Android commoditized.