It's so frustrating in retrospect: you want to reach back in time, grab Kerensky etc by the lapels and shout "JUST END THE WAR BEFORE IT'S TOO LATE!"
The Entente/Allies were forcing him to stay in the war IIRC.
Kerensky unfortunately was too idealistic for his own good, and his early popularity blinded him to deep discontent later. He could have concluded a separate peace (there was no way the Entente could have 'forced him' to continue, but he was too concerned with maintaining Russia's international prestige and had convinced himself that his personal popularity would make the soldiers willing to fight on.
It's kind of crazy, looking at how the Bolsheviks seized power, at how easy it was for them. From what I read, almost any group of 60 or so armed men could have seized control of the government at that time in November; the Bolsheviks were just the first to take the opportunity.
The Winter Palace to be sure, but the De Facto government by November especially in St. Petersburg was the Soviet which was controlled by the Bolsheviks. So, the only government that could have effectively maintained power was the Bolsheviks.
Kerensky might have been able to keep power mostly held by the Duma had he not insisted on launching new offensives against Germany. Interestingly though, the offensives weren't actually as foolish as they seem in hindsight. The allies had gotten a significant amount of arms to the Russians who were by the time of these offensives better armed than the Germans. Had there been a greater willingness to fight and had the Russian military not been led by incompetent leaders, they might have sustained the offensives and pushed the Germans back.