Was it more due to western imperialism and the embarrassment that the dynasty had to go through for example through the Opium wars, or was it more due to internal problems like the food riots and the general corruption?
The Qing fell due to a combination of factors which climaxed in the 1911 Revolution. This was carried out by revolutionaries in name, but the main driving force behind the revolution was the newfound political power of the rising Han gentry. We must evaluate four segments of society to answer this question: revolutionaries, soldied, the masses, and last, but not least, the rural gentry.
Revolutionaries such as such as Sun Yat-sen and Song Jiaoren desired to call the 1911 Revolution their own. Indeed, Sun was sworn in as the second provisional President upon his return from the United States, but the Tongmenhui which he nominally led was a fractured and decentralised, loose alliance of a wide spread of revolutionary societies. Revolutionaries were integral in driving the revolution - they initiated it, after all, albeit by accident. The role of the revolutionaries was played was not concerted, but rather revolutionary sects inspired by common anti-Manchu ideals set about, individually, fomenting unrest and revolutionary ideology amongst soldiers. On October 10th, 1911, ("Double Ten") a bomb went off in the Russian concession of Hankou, (part of Wuhan, in the province of Hubei) by accident. Revolutionaries were building a stockpile which went off, creating a fuss - Russian authorities allowed the Qing authorities to investigate. The identity of the revolutionaries was revealed and the list of recruits in the area was found. This risked the success of a revolution when the Tongmenghui and its allies had been planning, as possibly up to 1/3 of the Wuchang New Army was enlisted to serve the revolution. So they started early - the revolutionary elements of the army, many of whom had been inspired by ideas of anti-Manchuism but also disgruntled by issues with their pay, mutinied. This uprising succeeded in overthrowing the local authorities and co-opting a popular New Army commander, Li Yuanhong, to become the nominal President of the declared Republic of China until Sun Yat-sen could return from the Americas (where he was raising funds amongst the Chinese diaspora).
This leads us to the New Army - why did they participate? As I outlined above, this was generally to do with matters of anti-Manchuism and pay. I will come back to the former toward the end. Pay, on the other hand, was a simple affair - the Qing were under financial pressure from indemnities owing after the Boxer rebellion and further pressure from the upkeep of the New Army. Pay was not always an orderly affair, and so morale was low. The Qing were blamed, leading soldiers to be favourable of the Revolution.
The masses can also be considered here. Financial burdens on the centre led to increased taxation, which was levied on the masses indirectly by landlords - the Gentry. The gentry were on the receiving end of backlash from the peasantry, who were upset by the tax situation. This lent popular support to the notion of revolution, however the peasantry were not largely involved in the revolution. Popular support did play some role in the consideration of the gentry, however.
The gentry did not revile the Qing. In fact, they were the most supportive element of society of the dynasty except the Manchu themselves. Since 1905, and the defeat of Russia by Japan, notions of constitutionalism (championed notably by Liang Qichao) as a viable alternative to absolutism and autocracy gained popularity amongst the inner court. Why? Constitutionalism had been implemented in Japan (the Meiji Restoration) and blended the imperial system with a new, popular political ingrastructure imported from the West but adapted to support the Japanese imperial system. This system had not only triumphed over the Chinese in 1895, but defeated a Western power - Russia, which was autocratic, similar to China - in 1905. Self-strengtheners, reformers, and ever conservatives saw the merit of such a system. Constitutionalism became integral to restoring China, and thus the Empress Dowager Cixi, who had opposed the Guangxu Emperor's Hundred Days Reforms in 1898, embarked upon restructuring the Chinese political system. Reform came swiftly, and provincial assemblies were running by 1907. The Qing had sought to complete a restoration similar to Japan's by 1917. By 1910, a national assembly had met and a national parliament was on the cards.
Cixi and the Guangxu emperor died in 1908. Cixi was succeeded as Regent by Zaifeng, the Prince Chun, who was widely perceived as corrupt. He was the father of the Emperor Puyi, the Guanxu Emperor's successor, who was a child. Zaifeng was more conservative-leaning than Cixi and disproportionately relied on Manchu advisor. The Han Chinese gentry had been gaining political influence in Cixi's latter years, but under Zaifeng they saw, or at least perceived, their influence waning. They saw a threat to provincial autonomy and movements towards re-centralised and absolutism.
When the 1911 revolution broke out, the gentry saw their opportunity to retain their political power. They had stopped supporting the Qing, who had broken from a move towards constitutional monarchy under Zaifeng, and shifted their support towards the growing sentiment of anti-Manchu nationalism of the revolutionaries. The Manchu, in the eyes of the masses and the gentry, were no longer acting in the national interest and thus it was time for the Han Chinese to have a republican nation under their own direction. When the Wuchang Uprising succeeded, the provinces, led by leaders of the assemblies and buttressed by sympathetic (and opportunistic) New Army commanders, declared independence from the Qing.
What was it in for the army? Most provinces came under military governors, supported by the provincial elite, who tended to be the leader of the provincial New Army. What was in it for the gentry? They retained their political power. What of the masses? They were not against it, but neither were they involved. Their attitude toward the Qing meant that the provincial elite could act against the centre without fear of repercusion from peasant uprisings.
This is why the Qing collapsed. Constitutional monarchy had been promised, the provincial elite had been empowered, and the new power holders felt their grasp on influence slipping. A manchu-dominated court led by a young regent intent on centralising power turned away the support of the provincial elite, who in turn joined the cause of anti-Manchuism, the revolutionaries, and overthrew the ancient imperial system. One can further trace the causes to imperialism and rising Japanese power, which are what prompted the reform of Qing China's political system, though I have chosen to focus on why the revolution happened and why it succeeded as I feel it offers a more relevant answer to the question. I did this because the Qing did not fall straight away. It was not until Yuan Shikai forced their hand that Puyi abdicated. Yuan Shikai turned to the Republic because the rural elites, and thus the provinces of China, had. Yuan could have perhaps won a civil war and restored the Qing, but the Qing would ultimately have collapsed in the wake of the revolution because they had lost the majority of the elite. That's why I felt this to be the best approach to answering your question. If you have any further queries or you'd rather I approached it differently, do ask!
Anti-Manchuism played a larger role than I feel I've highlighted, and can be read in Joseph Esherick, ‘Reconsidering 1911: Lessons of a sudden revolution’, Journal of Modern Chinese History 6:1 (2012).
Sources:
Spence, The Search for Modern China (New York, 1999)
Fairbank and Goldman, China: A New History (Cambridge, Mass., 1992)
Zarrow, China in War and Revolution, 1895-1949 (London, 2005)
Bailey, China in the Twentieth Century (Malden, Mass., 2001)
Bianco, Origins of the Chinese Revolution, 1915-1949 (Stanford, 1971)
Zarrow, After Empire: the Conceptual Transformation of the Chinese State, 1885-1924 (Stanford, 2012)
Rankin, ‘State and Society in Early Republican Politics, 1912-18’, China Quarterly, No. 150, Special Issue: Reappraising Republican China (Jun., 1997), 260-281