The fighting over The February Revolution (which actually took place in March) began as a series of riots protesting food shortages and the ongoing unpopular war. Czar Nicholas II ordered the Dumas (the Russian Parliament) disbanded. Members of the Dumas refused to obey the dissolution order.
When Nicholas called on the army to put down the rioters, the army mutinied. Nicholas II was forced to abdicate. A provisional government was formed, the most influential member being Alexander Fyodorovich Kerensky.
On April 16th, 1917 Vladamir Lenin returned to Russia. The Germans had sent him in a sealed car from Switzerland. They hoped that Lenin would foment further instability in Russia since Lenin's Bolsheviks were opposed to continuing the war with the Germans.
For a number of months the provisional government ruled Russia. The government supported continuing fighting the war, which was extremely unpopular. The Bolsheviks led by Lenin advocated an immediate end to the war, giving land to the peasants and help to everyone else. Their popularity grew. On October 25th, 1917 the Bolsheviks led an armed resurrection against the government in Petrograd and seized power.
The new Soviet government was eager to end the war with the Central powers and immediately agreed to a ceasefire which went into effect in December. Negotiations began for a permanent peace but the Germans demanded large to annex large areas including Ukraine. The Soviets refused, and at one point walked away from the negotiations. The Germans began an offensive in which they captured most of the areas that they had demanded. The Soviets returned to the negotiations and agreed to all of the German initial demands
The treaty was signed on March 3, 1918, between the central powers (Germany, Austria, Hungary, Turkey and Bulgaria) and the Soviet government. Under the terms of the agreement, Russia lost Estonia, Latvia, Ukraine, most of Byelorussia, and Russian Poland. The treaty was annulled under the terms of the German armistice.