During the 1905 revolution in Russia there was a diverse group of active forces within the country that wanted to see his rule end. Despite the massive unrest he remained monarch of the country and continued to hold on to most of his power, why was the revolt unsuccessfull in deposing of him? and what were some deliberate actions taken by the tsar to ensure he remained in power?
It may seem a weird thing to say given the (correct) view of the Czarist response to the 1905 uprising as an orgy of repression, but the Czar also pursued concessions to the general revolutionar mood, if not to every specific demand.
Probably most importantly the Czar, acting under the influence of his Chief Minister Sergei Witte, authorised the creation of a State Duma - basically a Parliament with limited powers of oversight and financial control. While the Duma was quite limited in its powers compared to the British Parliament, the French Assembly or even the German Reichstag, it was literally the first time Russia had ever had anything like this at an Imperial level.
In addition to the Duma, Witte and the Czar issued a document known as the October Manifesto, where certain basic civil rights such as freedom of assembly and speech were promised.
There was a lot of backpeddling on these rights, especially after the first Duma was stocked with left wing deputies that turned out to be less grateful to the Czar than he expected and more interested in winning further concessions. But these concessions towards a more constitutional form of government, limited as they were, provided an important component in the Czar's ability to hang on.
Source: Shelia Fitzpatrick, 'The Russian Revolution', 1994.
You may want to see this question from a few days ago, which asked how Nicholas II survived 1905 but not 1917. The responses are not exhaustive by any means, but it does speak to your question a bit.
A lot of it had to do with the political concessions he was willing to make in the creation of the Duma, but there are a lot of cultural ties to the idea of a Czar in Russia, still, at this time as well.
While many were persuaded by the need for more popular power within government, in Russia the Czar was also a bit of a cult figure. He was the head of the Russian Orthodox Church, so he wasn't just a president or a dictator; he was a person authorized by god to oversee the direction of the state and the wellbeing of the Russian people.
For instance, there are many, many, little folktales and stories about people who encounter this problem or that problem, and decide to take it upon themselves to bring knowledge of the issue to the Czar, who will fix everything right up.
The semi-divine nature of the Czar, and the radical opposition from people like Lenin, really drove a wedge between the conservative monarchists and the more progressive or radical socialists, republicans, etc etc. So for awhile there was a balance of ideals where moderates could force concessions from both sides and the general populace was unwilling to go so far as the removal of their god-king.
Also, at this time, the illness of Nicholas' heir was not really public knowledge, Rasputin had not brought his occult power-personality into the Czar's court, and World War 1 had not yet killed millions of people. Part of a king's legitimacy comes from the public's knowledge of continuity. Knowing that the king will leave an heir to carry on his duties and to carry on society in a recognizable form helps to comfort people. Once Alexei had begun to show signs of illness and frailty, Nicholas' wife Alexandra began to turn to faith healers, religious leaders, and finally to Rasputin for help. Alexandra was already German-born, and as they begun to build towards WWI this became a huge issue for the Russian people. Plus, Alexandra angered them further by keeping Rasputin close by. He was a Charles Manson type, got off on control, manipulating others, was deeply into the occult, and loved to run his mouth. He often claimed that he was the true ruler of Russia, that he was having sex with Nicholas' wife, etc etc. People slowly became disillusioned with the entire court that Nicholas kept because he had a sickly heir, a German wife, and a court magician that seemed to have infected every aspect of the Czar's personal life.
The entire public image of Nicholas II was slowly poisoned over his last decade, and once you had a decade of horrible war, on a scale never before witnessed by human eyes...its not hard to see how it just became too much for the dynasty to withstand.
Plus, Nicholas was the second or third son. He was mostly kept as a tool for marriage alliances and otherwise allowed to pursue his own interests. Thus when kingship was thrust upon him, it was not really something he was prepared for, and not something that the populace had had decades to expect and mentally prepare for.