Microsoft is not counting only on its (not)Windows Phones but has also decided to invest in Cyanogen Inc. At the moment, Microsoft is a minority investor in the company that was created around a custom ROM in 2013 as $70 million was accumulated for the startup so far. Investors are evaluating the company at millions of dollars at the moment, which means Cyanogen Inc. can only grow from here.
Microsoft is still hoping you will pick a Windows Phone over Apple and Android choices, but they know their chances are slim. It appears that they would like to change the game a bit even if it means investing in a custom ROM.
The most important thing is that Microsoft is invested in this project at all, considering they usually finance projects that may or may not be successes on the long run.
Source: The Wall Street Journal