After the fall of Imperial Russia, there was a democratically elected Duma. The Mensheviks were the majority socialist party in that body, with the Bolsheviks being a smaller subgroup of them. As we all know, the Bolsheviks eventually overwhelmed the Mensheviks and took power as the sole party in Russia creating the Soviet Union.
I've never been quite clear how the Mensheviks lost to them.
The short answer is that the continuing war caused support for the government to erode, opening the door for a second revolution.
For the long answer, you need to understand that in 1917, there were actually several overlapping revolutions: over land, over working conditions, over political rights, against the war, against Prohibition and for nationalism among the Russian Empire's various constituent peoples.
After the February revolution, there was a deep disagreement among those that ended the monarchy. As a result, the Tauride Palace was almost literally divided. At one end of the palace was the Duma Committee, which took power as the Provisional Government. At the other end of the same building, the deputies elected by the workers created the Soviet of Workers' Deputies.
Early on, this Soviet was dominated by the Mensheviks and Socialist Revolutionaries. The Bolsheviks and others were on the fringes, sometimes participating and sometimes not.
The Soviet tried to defer to the Provisional Government as often as possible in order to preserve relations with the bourgeoisie and stave off a civil war. As the first issue of Rabochaia gazeta (Workers' Newspaper) stated on March 7, Russia was facing a long period of development before a revolution could take place. The Soviet could not take power because it did not enjoy the support of the bourgeoisie. A Soviet takeover would be "illusory power, power that would immediately lead to civil war."
The situation was a delicate balancing act between the demokratiia (the lower classes) and the tsentsovoe obshchestvo, the propertied classes.
The Soviet was under intense pressure from the revolutionary atmosphere of the time, and it had to take actions that we would consider governmental. It published orders for the garrison of Petrograd, it issued orders to arrest leaders of the old regime, it coordinated factory production and commandeered printing offices and determined the makeup of the police among other actions.
But the war loomed over all else. At first, the soldiers who formed a broad base of support for the Mensheviks and SRs supported the war effort. They thought the revolution would bring changes that would lead to victory.
This hope was an illusion that evaporated quickly. On April 19, foreign minister Pavel Miliukov sent a diplomatic note to the Allies saying that Russia supported their war aims and a "war to a victorious end." This language appealed to the upper classes, but not the lower ones, who read it as support for an imperialist war, not the defense of Russia and liberation of its German-occupied land. Workers and soldiers came out in droves, surrounding the Mariinskii Palace, and Miliukov resigned within days.
After this incident, the Provisional Government demanded the Soviet join it in a coalition government to end the divide. On May 5, Soviet representatives did so, linking the moderate socialists with the Provisional Government in a de facto rejection of the growing radicalism evident in the streets. The anarchists, Bolsheviks and Menshevik-Internationalists opposed this coalition government, and as the war continued, they seemed to have made the correct decision.
With casualties mounting and inflation rising (this erased wage gains the Soviet had garnered from the February Revolution), the support for the Mensheviks and SRs eroded. At the same time, the Provisional Government was accepting more socialist policies, something that alienated the middle and upper classes. When the Mensheviks and SRs called for state regulation of the economy, industrialists recoiled.
By June, Bolshevik support was growing, and the failure of the Kerensky Offensive further increased Bolshevik sympathies among the soldiers. More and more were saying that peace at any price was needed. In early July, radical soldiers and sailors attempted a coup that would have put the Soviet in charge. That failed, and the coalition government cracked down on the Bolsheviks and those who had attempted the coup. By this point, the demokratiia were demanding to put the Soviet in power, and the tsentsovoe obshchestvo were openly seeking ways to thwart this.
In August, Gen. Kornilov tried to march on Petrograd but was thwarted by forces mustered by enlisted soldiers and factory workers. This event, seen as orchestrated by the government, all but discredited the government. Meanwhile, the Petrograd soviet (the most important one) and the Moscow soviet were attracting more and more Bolshevik representatives. By September, they were the dominant party in both Petrograd and Moscow. Workers and soldiers were turning to the one major party that rejected the coalition and called for all power to the soviets.
I've pulled most of this reply from The Russian Revolution and Bolshevik Victory: Visions and Revisions, edited by Ronald Suny and Arthur Adams, which collects several excellent papers on the revolutions happening in Russia.
I just wrote a paper last year regarding the role of one of the leading Mensheviks, Irakli Tsereteli, which touched on this to some extent. I argued that it was the actions of Tsereteli, who was head of the Petrograd Soviet and a respected figure in the socialist movement, that paved the way for the Bolsheviks to take over in October.
After the February Revolution Russia was effectively controlled by two different bodies: the Provisional Government (which had the Mensheviks and included figures like Kerensky, Tsereteli, Lvov, etc), and the Petrograd Soviet (which was dominated by Trotsky and the Bolsheviks). While the Provisional Government claimed to be the sole legitimate successor to tsarist rule, it lacked the support of the Russian population, whereas the soviet did so, seeing how it was composed of representatives of the soldiers and workers. Thus a sort of symbiotic relationship was developed, where the government sought legitimacy though support from the soviet, and the soviet agreeing in order to maintain a role in directing the country. This system, known as "dual power" was horribly inefficient, but neither side was willing to upset the balance, fearful the other would usurp power and shut out the other. To cement the relationship, after the April Crisis (which saw demonstrations against the war and resignation of key cabinet figures) some leading members of the soviet were brought into the cabinet.
Both the Bolsheviks and Mensheviks within the soviet had members who were opposed to this, with the Bolsheviks the most vocal; the Mensheviks, while opposed, were primarily concerned with establishing a legitimate government and supressing any counter-revolution, and thus sacrificed some of their beliefs in order to work with a "bourgeois government."
It also didn't help that Tsereteli, who after serving in the cabinet went back to his position as a leading figure in the soviet, dismissed the Bolsheviks as a minor nuisance. He was well aware of Lenin's goals, but felt that they were not possible and contrary to the socialist revolution. He also pressured Kerensky to release Trotsky from prison in August, despite Kerensky's fears of letting Trotsky out. Tsereteli argued that he needed Trotsky to help stop the Kadets and other right-wing forces within the soviet; ironically soon after this Trotsky had Tsereteli and the Mensheviks outmaneuvered and the Bolsheviks took control.
Furthermore Tsereteli, even forced out of his office as head of the soviet, could have helped slow or stop the Bolshevik takeover, instead went to his native Georgia in September; while he felt that the Bolsheviks may attempt a coup, he was dismissive, telling Vladimir Nabokov (father of the writer): "they will not hold out more than two or three weeks."
Even discounting my attack on a figure Lenin called the "conscience of the revolution" it was largely political maneuvering that saw the Bolsheviks able to successfully launch the October Revolution. They saw the power that the soviet had, being backed by the people, and worked with that to throw out the Mensheviks, who had a tenuous hold on the government. That the Mensheviks were also more concerned throughout the summer of 1917 of a counter-revolution, rather than consolidating their power and establishing a more legitimate government, meant that when the October Revolution was launched they were unable to do anything about it.
I hate to begin with a spot of nitpicking but it's an important one: the State Duma did not continue to function in any meaningful way after February 1917. The first Provisional Government was founded by an emergency Duma committee but beyond this it was never responsible in any real dense to the Duma. The latter lingered on until October but was largely irrelevant.
The significance of this is that Provisional Government was constantly hobbled by a lack of legitimacy. In contrast its competitor, the Petrograd Soviet, was seen as a bona fide popular institution: an expression of the 'revolutionary democracy'. Right from the overthrow of the Tsar, and vividly illustrated by Order No. 1, it was clear that real power lay with the Soviet.
This was not a problem for the Mensheviks. Their assumptions had been that the February Revolution was a 'bourgeois' revolution, one that would lead to the creation of a democratic order akin to those in Western Europe. Yet the role of the proletariat lay in pressuring the bourgeoisie from below, via the soviets. As Tsereteli put it in March:
The Provisional Government must have full executive power in so far as this power strengthens the revolution, in so far as it is overthrowing an breaking down the old order. The proletariat represents the prime moving force behind these decisions; the proletariat dictates these decisions; the proletariat supports them with all its strength...
Will we succeed in organising a workers' representation... on such principles that would enable them to actually subject the bourgeoisie to their control... and at the same time to exert all their authority in support of those actions of the executive power which are essential to free Russia?
So right from the beginning the Mensheviks were comfortable with supporting (first from outside and then from within) the Provisional Government. The problem was that this dual power was inherently unstable. The continuation of war, sluggish pace of reforms and accelerating economic collapse all placed severe pressure on the Provisional Government.
At the same time the older narratives began to return and the revolutionary movement bifurcated. Suspicion between the demokratiia (lower orders) and tsenzovoe obshchestvo (propertied classes) mounted. Slogans calling for exclusive socialist rule (eg 'Down with the Ten Capitalist Ministers!' and 'All Power to the Soviets') began to gain traction amongst the working class; the 'bourgeoisie' lost faith in the revolution and increasingly looked to a military strongman for salvation.
To make matters worse for the Mensheviks, a key element in all this was the Bolsheviks. Lenin's return to Russian in April had seen his party decisively (and shockingly) move into intransigent opposition. In a break with accepted Marxist theory, they rejected cooperation with the Provisional Government, called for a government of the soviets and prioritised winning support in these.
Which means that when dual power began to buckle, the Bolsheviks were waiting with a programme/narrative that was much more in step with (shifting) working class thought. The demokratiia were faced with a simple choice: continued collaboration with the discredited Provisional Government or form their own Soviet government. Mensheviks or Bolsheviks.
I won't go into detail on how this process unfolded on the ground (I touch on this here) but over the summer of 1917 the Bolsheviks came to seize control of most of the working class organs: soviets, unions and factory committees increasingly came to vote for Bolshevik resolutions. By October they commanded a decisive majority at the Second Congress of Soviets - 300 of 670 delegates. (Contrast to the First Congress, in June, when a mere 100 of 784 delegates had been Bolshevik.)
So as the Mensheviks shackled themselves to a Provisional Government that staggered from crisis to crisis the Bolsheviks had effectively taken control of the Soviet movement. One of the most perceptive quotes from the Revolution comes from the Menshevik Sukhanov. Reflecting on the balance of power on the streets and factories in August 1917, during the attempted Kornilov coup, he noted that:
The [Committee for Struggle Against the Counter-Revolution] had to mobilise the worker-soldier masses. But the masses, insofar as they were organised, were organised by the Bolsheviks and followed them. At that time, theirs was the only organisation that was large, welded together by an elementary discipline, and linked with the democratic lowest levels of the capital. Without it the committee was impotent. Without the Bolsheviks it could only have passed the time with appeals and idle speeches by orators.
In March and April it had been the Mensheviks that commanded this support. They'd simply lost it to the Bolsheviks in the intervening months. And, as noted above, real authority in the dual power period had always lain with the Soviet and its masses.
Sources
Most of the above is fairly general. It's quite old but Anweiler's The Soviets is pretty solid on the approach of both parties to the soviets. And, as you'll have noticed, I'm a fan of a 'from below' history of the revolution: Suny's Toward a Social History of the October Revolution is probably the classic paper there.
Otherwise, I generally recommend that people start with Wade's Russian Revolution. For more info on how the Bolsheviks tapped into the popular conciousness, Rabinowitch's The Bolsheviks Come to Power remains a must-read.