There were a number of factors that led the British to finally grant India its independence in 1947. You may recall that Britain was the world's most powerful imperial power from the 1800's under the massive decolonialization movements in the middle 1900's. The phrase "the sun never set on the British empire" is meant to indicate the scope of British territorial possessions. The sun was always shining somewhere on some British property.
The first factor leading to Indian independence is often overlooked. While there had been rebellions throughout India since the 1850's, it was not until the British installed western style education in the first part of the 19th century, that the rebellions took enough form to become effective. In a way, this is why Thomas Jefferson so strongly advocated education in the new American republic in the late 1700's. He knew that an educated people are a lot harder to repress. It also shows why totalitarian regimes rely so much on state run schools and propaganda to keep their systems going.
With the rise of an educated Indian elite, more and more demands for independence were showered on the British. As the British often did, they responded with violence which, of course, made more Indians angry. Ghandi became a central figure in the transformation to an independent state through his use of nonviolence and civil disobedience. Ghandi was smart enough to realize that taking up arms agains a vastly superior military would likely lead to unacceptable casualties and not much change by the British.
Instead, he urged Indians to stop cooperating in the economic imperialism of the British. After all, the British had one reason to be in India and it was all about what resources they could exract. The Salt March is a great example of Ghandi's plan in action.
The end for Britian, however, comes on the heels of World War II. While there is little doubt that eventually the British would have left India, the devastation of the war on Britain certainly hastened their retreat. Exhausted from fighting, the British people had no stomach for fighting another war against a determined people half an earth away. The debate in Parliament was short and India was granted its independence in 1947...triggering massive unrest between the various religious groups that still lingers today.
There were many factors which contributed to Britains decision to withdraw from India in 1947. After 6 years of fighting in World War 2, Britain had accumulated a huge debt. They could not afford to maintain their troops in India and could not afford to send more to stop a push for independence. They did not want to be pulled into an Algerian type war.Also after World War 2 the British people were not prepared to have another war to stop Indian independence.
Another factor which contributed to Britains decision was the fact that the idea of empire in the 1940's was very unpopular. America, Britain's main ally in World War 2 was against it. Also Britain had just fought a war against Germany to prevent them from starting an empire and now Britain could not be seen to force countries to stay in their empire.
Another factor was the rise of educated people in India and subsequently a rise in Indian nationalism. Due to the fact that Indians could go to university in Britain many now educated Indians began to demand Independence. Ghandhi, Nehru and Jinnah, all leading figures in securing Indian independence were all educated in Britain.
One of the main reasons that India had not been granted independence earlier was Winston Churchill. The former prime minister supported the ida of empire and therefore was not prepared to talk about Indian indepence. This all changed in 1945 when the labour party won the election in Britain. Their leader and now the new prime minister Clement Athlee was against empire and suppotede the idea of granting indian indepence
The tea prices. Also the rebellion.