Steve Ballmer's 13 years at the top of Microsoft began as the new century dawned, but he leaves the world's biggest software company at a crossroads where it must choose between the decades-old desktop market or the 21st-century world of mobiles and tablets.

He hinted in the memo for his abrupt announcement on Friday, and in subsequent interviews, that the timing wasn't his choice. "This is an emotional and difficult thing for me to do," he told staff. Asked if it was a sudden decision in a later interview with ZDNet, he said: "I would say for me, yeah, I've thought about it for a long time, but the timing became more clear to me over the course of the last few months."

Ballmer had come under intense pressure since May, when ValueAct Capital Management bought in to the company, saying it was undervalued – and Ballmer himself was part of the problem.

But the attacks had begun even earlier, starting in earnest in 2011 when the influential investor David Einhorn, of the Greenlight Capital hedge fund, called for him to step down, saying he should "give someone else a chance" and that "his continued presence is the biggest overhang on Microsoft's stock".

Microsoft's shares fell below $40 in June 2000 after the dotcom bust, and since then have not gone above $38 – compared with an all-time peak of $58.72 in December 1999. That has frustrated shareholders and led to activists seeking to force Microsoft to dump unprofitable businesses such as search, and concentrate on its highly profitable Office and Server businesses, rather than consumer-facing ones like Xbox and smartphones.

As ValueAct began to look likely to win a seat on Microsoft's board – from which it could begin a proxy fight to force him out – Ballmer decided to move on, even though the company is still in the midst of a huge upheaval that will rearrange its 97,000 staff from five product-oriented divisions to a "vertical" model, mimicking Apple's, where marketing and design teams work across all products and services.

Key reasons for the heightened pressure on Ballmer were the failure of Windows 8, released last October, to lift PC sales out of a continuing slump, and Microsoft's still-tiny share of the fast-growing smartphone and tablet markets, said Al Hilwa, a director at research company IDC.

"If Windows 8 had buoyed PC sales it would have let out some of the pressure on him to announce his planned departure since the turnaround would be seen as well under way," Hilwa told the Guardian. "Instead, it is clear there is more work to do. To be sure, he is going to be at the helm for some time and so these are still problems for him to tackle."

A key challenge is that Microsoft has failed to find any big-money hits with consumers in the 21st century – leaving it reliant for its gigantic profit flows on Windows licence sales, and renewing licences from businesses.

Now Ballmer's successor will have to decide whether to chase consumers with newer products, or intensify the focus on big business as a source of profit. The slump in consumer PC sales – down 20% over the past year – has not been compensated for by tablet or smartphone sales. Newer businesses are losing money. In the last two years alone, Microsoft has lost almost $3bn on its Bing search engine and other internet projects – not counting a $6bn write-off on the 2007 purchase of online advertising agency aQuantive. Last quarter it took a $900m hit on its Surface tablet, which has sold poorly, and only 300,000 of its Surface Pro tablet for business are reckoned to have shipped in the quarter to June – against a world market of 45.1m. Smartphones using its Windows Phone software have only single-digit share in the world market, and only 4.4m out of the 141.8m smartphone users in the US, Microsoft's home market.

There is no chance of Bill Gates returning to the chair, say insiders, because he is focused on his charity work. Instead, potential candidates must know how Microsoft operates – and have the mixture of experience, engineering and vision to lead the company.

Stephen Elop, who left Microsoft's Office division in September 2010 to take over at Finnish phone maker Nokia, is seen as a strong outside candidate because of his earlier experience with the enterprise and consumer markets, as well as the key business of mobile.

Satya Nadella, who looks after the Cloud and Servers businesses, could also be favoured. Qi Lu, an ex-Yahoo engineer leading the Bing search team, is seen as another front runner.

"Taking an internal candidate like Nadella or some of the other people on the Windows team, that makes sense to keep a steady hand through this reorganisation and strategic shift," Norman Young, an analyst at Morningstar, told Reuters. "But a strong case could be made that the company needs a breath of fresh air, someone who can execute on the strategy but also bring an outsider perspective."

Ballmer oversaw a series of errors that have left Microsoft scrambling to catch up with Apple, Google and Amazon. While Apple's success with the iPod was unexpected early in the century, Microsoft's reaction was at first uncoordinated, and then it undercut licencees by launching its Zune music player in autumn 2006. That was Ballmer's idea – but it arrived just as the digital music boom ended and smartphones took over.

Similarly, in autumn 2009 he personally killed a project devised by Xbox innovator J Allard – a book-like tablet called Courier which could have arrived at the same time the next year as Apple's iPad. Instead, the iPad went into the market unopposed.

In search, Ballmer in 2003 personally vetoed the idea of buying Overture, which owned key technologies relating to search ads – arguing Microsoft could build its own as it began competing head-on with Google that year. Instead, it has lost billions of dollars on its Bing search engine, while Google licensed Overture's patents for its money-spinning AdWords service.

Amazon, thought of as just a retailer, stole a march by offering "cloud" services such as storage and processing, a space it now dominates. Microsoft, reliant on desktop software sales, was slow to pick up on its importance, despite Gates having espoused it in 2001.

Nor is Microsoft out of the woods, even as it readies the launch of an update to Windows 8. PC makers, seeing sales to consumers slump, are wary about Microsoft's entry into the "devices" business with its Surface tablets. A source at one of the PC industry's biggest suppliers said: "So far Microsoft has been co-operating with us, rather than being in direct competition. But they're at an inflection point. They either pull back [from the Surface] or they push deeper. And if they do the latter, then we are in competition."

With PC companies under increasing pressure, – with Dell seeking to go private, and HP seeing single-digit margins from PCs – that could drive them towards other platforms, or to compete fiercely with Microsoft's products.

Hilwa argues however that Ballmer did deliver exactly what the market wanted. "During the period he ran Microsoft, Ballmer is third only to Exxon's Rex Tillerson and GE's Jeff Immelt in the dollar volume of company profits he has delivered," he said. From 2000 to 2012, Microsoft's profits totalled $172,813m, against $199,393m at GE and $388,480m at Exxon."I'm not sure there is someone who can do Steve's [Ballmer's] job 'better'. It's an incredibly difficult job, perhaps intractable," Brad Silverberg, a former senior Windows executive and co-founder of Seattle venture capital firm Ignition Partners, told Reuters. "Perhaps the way the job is defined needs to change, and this is the harbinger of bigger changes to come."

• This article was amended on 28 August 2013. An earlier version gave Microsoft's profits from 2000 to 2012 as $172,813bn. That has been corrected to $172,813m. Profit figures for GE and Exxon have also been corrected from billions to millions.