The Mughal Empire declined during the first half of 18th century. The rulers lost their power and the empire was left only to a few square miles around the capital of Delhi. Delhi was also later captured by the Britishers and the Mughal emperor was made the pensioner of the foreign power. The stability of the Empire had been lost after the strong reign of Aurangzeb yet it continued to prevail because of its policies. The main reason for the decline of the Mughal rule is their in house fights.
The close relative and Sons of the ruler fought among themselves for power and money. Often the ruler what imprisoned and tortured by his own sons. Also due to this in house fight outsiders tried to take the advantage. They tried to seize the power from the Mughal princes and administer the Empire freely. Also the Mughal policies with their contemporary Hindu rulers was not very tolerable. This led to a large number of wars between them and therefore the mughal empire succumbed due to lack of funds and also, recruiting a strong army and paying salaries was getting difficult for the mughal rulers.
The last mughal emperor bahadur shah zafar, was declared as the leader of 1857 revolt but his lack of leadership skills and also the lack of a good trained army and weapons made him loose the control of delhi. And with this blow mughal empire officially came to an end.