Why do you think MS makes software for Apple hardware?

I still don't get why MS is making softwares for Apple products. I get that they are a software company and they need to find ways to sell their softwares. But, after the Surface announcement and the increasing popularity of Apple, why do they still make software for their competitor, Apple? PCs can't install any of Apple's software (without hacking) yet, Macs can install Windows and Office for their Macs and soon, the rumored iOS Office. This gives Macs and iOS devices the edge and gives users more reason to buy them, Surface will be a competitor for the iPad so, I don't really get why MS is making Office for the iPad in the same year when they will release their tablet-oriented OS and their very own tablet, Surface. Can someone tell me a logical explanation. I'm not a hater of Apple or MS, I'm just curious if there is any hidden intention or logic behind MS's Mac/iOS softwares.