> How do they manage that when they have to pay for both hardware and software development, when all the others get the software for free?
It's their ecosystem, all their hardwares work very well between each other. You have Apple messenger on a macbook connecting to your iphone. For android you need to download pushbullet. I'm not in the ecosystem I prefer Android but I can see why people such as consumer would continue to buy Apple stuff. I'm not entirely sure about their laptops though...
Also Apple make a lot of money from services such as itune and their app store. Itune made more than Spotify. It all works together with their close ecosystem.
It's a real pain to move from apple to android because text messages goes straight to apple server. You need to sign off and jump a hoop to get text message back to android. Also getting mp3 off of itunes or getting bandcamp mp3s on to itune. It's like LA fitness, at least in 2010, where if you want to cancel your gym membership you need to download the pdf from their website and then mail it to the provided address and then they'll charge you anyway one extra month.