Most of desktop market belongs to Microsoft, which is surprising to an Apple user. What went wrong, what factors were against Apple, what decisions were made that prevented it from conquering the market despite Apple's being the "technically" better machine?
The Rise of the IBM PC was very quick. The Apple II had done well and blazed a path but many as a hobby computer more than a business machine, and it was tagged as cute rather than practical. IBM had huge brand clout in Business an businesses looked at the IBM offering favourably just because it came from IBM.
The Apple II had an open architecture but had limitations as a computer. It was not a great architecture to support computer languages over assembler. Generally you added a CPM Z-80 card if you wanted that. It was too hard to develop applications in assembler.
The IBM-PC 8086 based PC was close to the old 8080 and CPM Z-80 cpus and was easy to rapidly port software from theses architectures. The IBMPC thus was a technically better platform for software development that the Apple II. Ot was easier to write software for.
Timing was good the IBM PC entered the market just as business was looking for a computer, and many software companies were starting to write software applications. The IBM PC intent was to quash apple, IBM were offended that by the notoriety of apple, the success actually was a surprise to IBM.
Really Really awful mistakes by their Competitors, the Apple III was a badly botched project. Incredibly badly delivered machine that saw Apple get the IBM PC the opening. The Earlier incredibly short sighted dumb more by DEC to castrate their micro-11 computers, the most advanced machines with the best existing suite of software (afraid that it would eat into their successful mini computer pdp-11 sales, they hamstrung the professional series of computers , perversely tis was what the Russian home computers of the early 1980s were based on, technically the Russian PC's were actually superior architectural, sure they stole the design, but they stole the best)
The Macintosh was an overly ambitious design and when it was delivered it was clunky slow computer to use, It just did not have enough memory to support a speedy windowing interface, sure the Mac had great design and the new interface (actually developed by Xerox PARC) would be a winner, but without enough memory it was too slow. It also was a big jump for software developers, Apple consistently produced bad systems software (Operating Systems) while much of the apple libraries were great the operating system architecture was poor. (Eventually apple solved this in OSX by just putting their own layer on top of unix, the world's best OS, remains so even though designed in the 70s, Windows remains a toy by comparison)
Developing a computer system and delivering it to the market is complex, and a lot of companies have failed even with basically good products. IBM delivered at the right time, their architecture was very close to existing 8080/Z-80, Hal was right about those code warehouses) which made them an easy and relatively familiar development environment, the IBM PC was a slighter more advanced design that had the ability for more memory and support languages that made application development easier. Previous machines like the apple II just were a little tight for that. After the IBM PC most companies delivered very ambitious designs (Mac, Atari ST, Amiga etc) which just were slow, clunky or buggy early and they were coming into the new IBM dominated markets with radically different software architectures that took a lot of work to conquer.
But the tim the Macintosh was competing with Microsoft (MS-Dos, Windows) Microsoft already had a very dominate position, and apple had chosen to go down the closed system path after it's experience with Apple II clones, Apple was much more closed with the Macintosh, this meant the Macintosh was going sell at a premium and not benefit from competing third party hardware suppliers. Once most software companies had already moved into supporting the 8086/Intel/Microsoft world, it was amor effort to write software for the Mac, which didn't have enough Market share, the Mac was always fighting from a minority share. Microsoft was able to use it's monopoly position to effective tax the manufacturers of hardware. With a large demand for ms-dos/windows, Microsoft insisted to get OEM versions of their OS software you had to install them of ALL the hardware produced, so even if the customer just bought the box and installed a non Microsoft OS the cost was already paid to Microsoft, if the producers did not play by Microsoft's rules they were just cut out of the Microsoft OEM. Microsoft had an established dominate position that it used. Apple having the smaller maker went for point of difference and become as smaller cult machine that people were willing to pay a premium for.
The best answer I've ever seen to this question came from Eric Raymond's The Cathedral and the Bazaar*.
The basic gist of the argument is that when it comes to a competition between a more closed platform and a more open platform, the closed platform loses every time. Even if it starts off technically superior.
Other examples of this principle in the history of platforms are VHS vs. (Sony-only) Betamax, Unix vs (DEC-only)VMS, Android vs. Blackberry, etc.
Since computer platforms of the day could not run each-other's software, users had to pick one. If they picked the Apple world, they were reliant on a single company for all hardware and OS innovation on their platform. Also, Apple has nearly no price pressure, as nobody else makes alternative versions of their equipment.
In the PC world, anybody can make a new piece of PC hardware. Anybody. For instance, the PC I'm typing this answer on contains an AMD CPU. I bought it because it was a bit cheaper than the competing Intel CPU for the performance point it gave me. The same thing goes for my video hardware, motherboard, motherboard chipset, RAM etc. Everywhere intense competition pushing vendors to do better for cheaper.
Apple is a very innovative company. But no matter how good they are, they simply cannot beat the rest of the world combined. So what happened was that even though the PC was a technically inferior offering initially, its various vendors over the years improved it at a rate that single companies like Apple, Commodore, and Atari just couldn't match.
(The more interesting question to me is why Apple managed to survive. It nearly didn't)
* - My memory is that a much more explicit version of this argument was made by Nick Rossi of the Pittsburg Post Gazette in 1999, but sadly his original article no longer appears to be online.
Bill Gates and Steve Jobs were genius businessmen, but Steve Jobs made two missteps, the Apple III and the Lisa, and was fired for it just as his newest effort, the Macintosh, was exploding in popularity.
Gates, on the other hand, as a software impresario, let other people take risks with hardware.
He let IBM design the hardware, and then supported the early clones from Compaq and Dell and fostered a healthy commodity-PC ecosystem at IBM's expense. (IBM no longer manufactures computers that run a Microsoft operating system.)
He cheated people. Often. He acquired a CP/M-knock off OS, 86-DOS, for an absurdly low sum, and then used the product he had essentially obtained for free to undercut Digital Research's CP/M. Windows Internet Explorer was originally licensed to Microsoft by Spyglass for a royalty on every copy sold. Gates bundled it for free with every copy of Windows 95, which means he didn't have the pay the royalty. He paid them $8mil to go away when they threatened to sue, a paltry sum. Microsoft used pawns like the San Francisco Canyon Company to steal access to competitors' source code.
Then there are the little things he did to ensure an unchallenged monopoly (well, unchallenged until Jobs returned to Apple) - he required all PCs to be sold with Windows, or he'd ramp up the cost of bundling Windows until the hardware manufacturer went out of business. This had a huge hand in killing OS/2 and slowing Linux's adoption. They would make undocumented API changes to deliberately interfere with competitor's products, when Microsoft got into the productivity software game, the rallying cry at Redmond was "DOS ain't done until Lotus won't run!" They cut ludicrous bundling deals for large customers who bought MS Office, essentially giving them the OS for free. Sharp business, but an illegal use of their monopoly position, and par for the course.
The Mac has high-margin equipment that is simple to maintain and use - it doesn't need to be huge to be a success. Jobs' success with the iMac and iBook indicated a well designed product with a solid system underlying it could be profitable even in a niche.
Microsoft MS-DOS and then Windows are unfairly low-margin products designed to sell Office and other software licenses, using a business model that relies on hardware vendors to to develop advanced computers for them free of charge and compete with each other to apply downward pressure on hardware prices.
IBM was arguably one of the greatest companies in America as they introduced the PC. They had decades of continuous earnings growth. They were what every American business strove to become. They went decades without firing any employees. When they went into the PC market they used cheap off the shelf components including CPU, Architecture, and Operating System. What they invested in heavily was software. The day the PC came out it had 500 software packages to choose from. Apple had been on the market for years at the time and they still didn't have the kind of software catalog IBM introduced on day 1.
IBM PC became synonymous with Business and professionalism. Apple became synonymous with hobbyists, meaning "Looks good but not practical". Since IBM used open components, clone manufactures quickly brought cheap competitors to the market which made IBM computers / clones significantly less expensive. Big businesses still purchased IBM machines, but everybody else could buy clones for half or a third of the price. Apple had always been more of a hardware company and now they were competing with small shops which could afford to operate on $50 margins which Apple couldn't hope to reach.
In the end, the PC controlled the high-end business market, and the clones controlled nearly everything else. Apple became thought of as an expensive toy with 5-10% of the market. If you really wanted to do serious work, you purchased an IBM. That's what they used in schools, That's what was used at work, so that's what people purchased for their homes.
Apple nearly went under. Apple always had a diehard core group of supporters. But they had production problems, dead-end expensive product roll outs, and they always cost significantly more than PC offerings. Jobs 1.0 was a technical visionary, but he was never trusted by Apple's money men to run the company. So poor management decisions by Apple were also part of the problem. Poor coordination between Jobs and whoever was running the company. Apple hired a series of good general business people who just didn't understand the PC market. It nearly killed the company.
By 1985 IBM was so dominant that competitors and analysts speculated that it would again be sued for antitrust. Datamation and others said that IBM's continued growth might hurt the United States, by suppressing competitors with new technology. Gartner Group estimated that of the 100 largest data-processing companies, IBM had 41% of all revenue and 69% of profit. Its computer revenue was about nine times that of second-place DEC, and larger than that of IBM's six largest Japanese competitors combined. IBM's profit margin of 22% was three times the 6.7% average for the other 99 companies. Some companies complained to Congress, ADAPSO discussed the company with the Justice Department, and European governments worried about IBM's influence but feared affecting its more than 100,000 employees there at 19 facilities.
IBM's reaction to this was to back away from the most visible part of their business, which also was not among their best revenue generators, the PC. They introduced the Microchannel in 1987 and went from the leading PC manufacturer to a boutique PC provider specializing in servicing large companies/governments. But they had already supplanted the Apple as the primer personal computer years earlier. Almost from the beginning, there was no contest. The PC had the IBM name, the software catalog, and compared favorably on price.