Why is it that the Hindu religion is still a vast majority in India considering the fact that they were ruled by various muslim empires who often sought to expand Islam?
That is because, by and large, the various Islamic rulers in India aren't bent on extermination. Wholesale slaughter tend to erode your tax base.
That is not to say that Muslim rule in India is consistently that of religious tolerance and harmony; there are, of course, particularly bloodthirsty ones, such as Aurangzeb of the Mughals, who persecuted Hindus, Sikhs and even other Muslim kingdoms such as Bijapur and Golconda (whom he thinks is getting too tolerant).
However, even holy fervour has to take pragmatism into account. For example, during the Bahmani-Vijayanagara War, Sultan Muhammad Shah vowed to kill a hundred thousand Hindus in retaliation for the Vijayanagara kingdom's slaughter of the garrison in the town of Mudkal. His armies killed almost five times the number, and he only stopped when his own officers pointed out to him that he vowed to kill a hundred thousand Hindus - not all of them.
I'm by no means an expert in this field, but I have in the past read a little about the Mughal Empire in:
Charles Parker, "Global Interactions in the Early Modern Age, 1400–1800" (2010)
John Darwin, "After Tamerlane: The Rise and Fall of Global Empires" (2007)
There's also a web article here http://sensiblereason.com/muslim-hindu-religious-interactions-in-the-mughal-empire-the-birth-and-death-off-a-cohesive-culture/ and another here http://www.bbc.co.uk/religion/religions/islam/history/mughalempire_1.shtml
The Mughal Empire, which ruled much of Northern India in the 16th to mid 19th Centuries, was often fairly tolerant of Hindus and some rulers went to lengths to emphasize the syncretism between Hinduism and Islam. This is often reflected in the poetry of the region where poets would draw on both Hindu and Islamic traditions. The syncretism was also reflected in many buildings built by the Mughals, which incorporated Islamic and Hindu architectural styles. Until the last Mughal Emperor Aurangzeb, Hindu's were granted a few special freedoms, including the ability to follow their own laws rather than Sharia.