World War 2 was single biggest reason for India's independence. Other factors simply acted as co-factors. The British suffered so greatly in World War 2 that they did not have enough men to govern the large empire. There was a generation of Indians who were educated in Nationalistic schools and were not as brainwashed as their counterparts who were educated in British Funded schools and had become important part of British government.
Large number of Indians, particularly Hindus, were enlisted in Army. Most of them were nationalistic People. The hold of British on armed forces was wavering. This is evident by the fact that Naval forces in Bombay and Air force in Karachi rebelled against British government.
These two mutinies within span of 12 months (Naval mutiny in 1946 and air force mutiny in 1945) shook the belief of British that they could hold India by force for long. The unprecedented support that Indian National Army (INA) of Subhashchandra Basu in general public of mainland was also against the forcible occupation of India by British.
The moderates, like Gandhi, were successful in igniting discontent in minds of general public of India. They made every Indian FEEL that India must attain independence. I do not agree with philosophy of Gandhi nor do I agree with his modus operandi.
But he was greatly successful in intensifying the discontent in hearts of Indians which was ignited by Lokmanya Tilak, his predecessor.
He also invented a way through which common Indian man can contribute to cause of Indian independence,Satyagraha. Common man in India is not a dare-devil. He is certainly incapable of assiduosly carrying out all the actions that revolutionaries perform and is incapable of bearing the consequences. This is partly due to the fact that Indian man loves Status quo. There has NEVER been a revolution in India, particularly in Hindu India; with notable exception of Pushyamitra Sunga.
Satyagraha enabled Common 'Status quo loving' Indians of contribute their 2 cents to the larger cause of Indian independence. It provided them necessary safety and security that their lives won't be forfeit. Hence they contributed to the movement with alacrity. However this fact cannot be ignored that in doing so, Gandhi created a Nation of Cribbers who protest and strike for all the negligible causes. He ensured that Indians won't ever protest in constructive manner as, for example, Japanese do. The authorities become senseless and deaf due to continuous protests, and the sufferers have to become audacious to have their voice heard. Thus, India has entered a vicious cycle, thanks to Satyagraha Philosophy.
All these factors contributed to the cause of Independence of India which was direct result of Pyrrhic victory achieved by British over Germany. It is common misconception that Quit India movement was non-violent. Quit India movement got over in few days it started. In these war years, common Indian were fighting in all possible ways, whichever they felt was necessary and appropriate. And most of the times, it was Violent way.
There are various instances like that of Krantisingh Nana Patil of Solapur who established parallel local governments, creating many BRITISH FREE ZONES in British India. Government could not react these attempts with great fervor as it was busy in WW2.
It is garrulous to state that Congress, Gandhi gave India her independence in Non Violent Satyagraha, as it is commonly imprimmed upon young minds in India. This is an insult to all the other people who contributed their efforts, hearts and souls for Indian independence and who did not approve the means of Gandhi and Congress hijacked by him.
It was World War 2 and subsequent enervation of British Empire along with increase of nationalistic Hindus in armed forces who were not very keen to serve under British supported by great support of Common Indian Man in all possible ways, that led to India's Independence.