What worked was the decline of home PC users in favor of smartphones; Microsoft was never able to do well in this space despite buying Nokia's phone business (let alone dominating it as they still do on the desktop). Modern Microsoft has entirely switched to being cloud focused from just an OS vendor - their big money spinner these days is Azure, followed by Office 365 and then only Windows. It's also why Windows 10 and 11 are so user hostile compared to earlier versions; Microsoft doesn't have to care about a good user experience and will inevitably push the OS itself to a subscription model.