I respectfully disagree with the above answer. It was economic problems at home and Nicholas insistence on ruling as an absolute monarch, not the loss of confidence by the Russian Generals, that forced Nicholas to abdicate.
Although Nicholas II was a pious and dedicated family man, he was ill equipped to rule under any circumstances, let alone a country the size of Russia with its myriad problems. One observer said of Nicholas that he:
would have been an ideal country gentleman, devoting his life to wife and children, his farms and his sport
He was traditional to the core, and believed he had a solemn duty to preserve the monarchy. This he believed, together with the Russian Orthodox Church, had secured Russia's legacy as the Third Rome.
After the 1905 revolution, Nicholas II had created a Duma (legislative assembly) for the Russian people, however Nicholas had no confidence in the Duma and instead relied on the antiquated Russian bureaucracy. He had absolute veto power over any decisions of the Duma, and exercised that power frequently. His failure to consult the Duma brought him under increasing criticism not only from members of the Duma but also from the middle class. When calls were issued for a new government more responsible to the people, Nicholas dismissed the Duma.
Next, Nicholas dismissed his War minister and travelled to the front himself to lead the war effort; he believed that his presence there would inspire the troops. Nicholas had no war experience, and this was an insane mistake. While he was at the front, his wife, Alexandra, fell under the influence of Grigori Rasputin, a self styled "holy man" who often interfered in family and political matters and caused deep resentment among the Russian people. Alexandra had a strong dislike for Parliamentary government and had long believed Nicholas should rule absolutely. While he was away and at Rasputin's urging, she attempted to do so herself; an act which further alienated the already troubled Russian people.
Economic deprivation finally took its toll, and on March 8, 1917, bread riots broke out in Petrograd (formerly St. Petersburg). The riots soon spread and Nicholas issued orders from the front that the army should restore order. Instead, soldiers broke ranks and joined the rioters. The Duma then assumed control and declared a provisional government. Nicholas knew his days were numbered, and abdicated on March 16, 1917.
Czar Nicholas II abdicated because he realized that the leaders of his army had lost faith in him.
By 1916, many Russians had become very frustrated with their government. It was losing very badly in World War I. It had been unable to provide much in the way of prosperity or political freedom for its people. In other words, it really did not have anything going for it. This discontent had been building for decades as Russia continued to lag behind the rest of Europe both in terms of economics and in terms of political rights. World War I provided the stress that made things fall apart.
In early 1917, the army's leaders became convinced that they could only succeed in WWI if the people could be persuaded to have faith in the government. They were convinced that this could only happen if Nicholas abdicated. Once he understood that the army had lost faith in him, Nicholas agreed to abdicate.
So, the immediate reason for Nicholas's abdication was that he lost the confidence of his generals. But the real reason behind the whole thing was the fact that the monarchy had kept Russia extremely backwards in economics, politics, and society.