They did invest in mobile from fairly early. Microsoft was selling smart phones (through third party manufacturers) in the early 2000s. They just executed very poorly on mobile by building the wrong thing for the wrong customers. By the time leadership figured this out and started to pour money into Windows Phone, they were too late to catch up.
App stores and app platforms became critical to the success on any mobile platform. Microsoft didn’t sufficiently cultivate the Windows CE based apps enough. Then they ditched that app platform for a new one in Windows Phone 7, losing what little they had. Companies that had built apps for iPhone and Android had no incentive doing so on Windows at that point.
Ballmer at least recognized the value of Azure, Office in the cloud and similar efforts. All the seeds of Satya’s success were planted during Ballmer’s reign. There was just so much fumbling.