This started as a comment on T.E.D.'s answer, and has turned into some insights into the smart phone market and why Microsoft failed.
Full disclosure, I work on a Macs, game on Windows, and use Android phones. My first smartphone was a Nexus One I got for free(!) for attending a free Android Developer Tutorial hosted by Google back when Android was kinda crap. Never did write an Android app.
While raw numbers of devices shows Apple "losing" and Google "winning". The reality is they're both winning at their chosen games.
Alphabet (Google's parent company) doesn't sell phones. It doesn't sell software. Even most of its services are free. Alphabet sells its users. Alphabet makes its money on advertisements and selling its users behavior. Alphabet made $95 billion in advertisements last year, 86% of its total revenue. Android exists to funnel users to Alphabet's services so it can serve them ads and collect extensive data about their users to sell. It's in Alphabet's best interest for Android to be free and ubiquitous and on as many phones as possible.
In stark contrast, Apple is primarily a hardware company. Apple makes over half its revenue selling iPhones to the tune of $142 billion in sales last year. iPads made $21 billion. In comparison, Macs made $25 billion. iOS exists to sell iPhones and iPads.
Both companies make money from their app store taking anywhere from 15% to 30% of app sales as well as subscription fees. But this is small potatoes compared to their major earners: advertising (Alphabet) and hardware (Apple).
Clearly both are doing quite well.
What about Microsoft? Unlike Alphabet and Apple, Microsoft is scattered. Rather than a colossus, Microsoft is a conglomeration of divisions. Their revenue is evenly split between "Productivity and Business Processes", "Intelligent Cloud", and "More Personal Computing".
This includes their software such as Office, Skype, Exchange, SharePoint, Outlook, and Dynamics. These have consumer and enterprise versions, installed and cloud versions. They run Web sites like Linkedin, Github, and Bing. They do financial management, resource planning, and supply chain management. They have developer tools like SQL Server, Github, Visual Studio, and Azure. They sell the XBox, and develop and publish games. They sell tablets, keyboards, mice, and accessories. And, of course, they do Windows.
Android is a core part of Alphabet's strategy to serve ads. For Apple, the iPhone was developed as one of its small stable of hardware. But for Microsoft, Windows Phone was just one more product in a sea of products.
To put this in perspective, in 2010 when Windows Phone 7 came out, the revenue for Microsoft's entire Entertainment and Devices Division division which included XBox, Zune, PC Games, Mac software, PC hardware... and the Windows Phone was $8 billion. In 2010 Apple sold $25 billion in iPhones alone.
This lack of focus meant despite Microsoft's huge size, compared to iPhone and Android, Windows Phone was rushed and starved of resources.
Part of the reason behind a lack of upgrade path for applications, [Larry Lieberman, senior product manager for Microsoft's Mobile Developer Experience] added, was the timing required to push Windows Phone 7 Series to market. "This product was delivered in an incredibly accelerated timeframe," he said. "If we'd had more time and resources, we may have been able to do something in terms of backward compatibility."
Source
As a result, Windows Phone 7 broke backwards compatibility with Windows Mobile 6 wiping out their software library. Windows Phone 7 phones couldn't run Windows Phone 8 making upgrading expensive. Unlike Android's integration with Google's excellent services, Windows Phone was saddled with Bing services.
iOS and Android are dedicated smartphone and tablet operating systems allowed to do their own thing separate from their desktop counterparts. In contrast, Microsoft further complicated Windows Phone by attempting to unify their desktop, tablet, and phone operating systems. This extended to software, user interface, and branding. It might have been a major coup if they pulled it off, but they didn't. Instead this "one size fits all" approach lead to confusion and compromises for all.
Examples include their attempt at unifying the user interface with Metro. Small touch screens have very different needs from mouse and keyboard based monitors. The result was an interface that worked well enough on phones and tablets, had some interesting features for touch screen laptops, but was a jumbled mess on desktops harming Windows 8. In the end, touch screens did not become ubiquitous in the laptop and desktop space.
Windows RT promised to move applications seamlessly between desktops and tablets, but instead resulted in something between a crippled laptop and a very expensive phone further diluting the Windows Phone.
Microsoft learned the hard way what Apple knew: phones are not laptops nor desktops.
The Windows Phone was rushed, under-funded, and unfocused. It was saddled with second-tier services and a design compromised for other devices. Application developers were hamstrung by incompatibilities. Was it a smartphone or tiny laptop? It tried to be both on a budget for neither.
Sources