According to this, Egypt became majority Muslim by the mid-10th century, about 300 years after the conquest, and today is almost 90% Muslim. But India today is 80% Hindu, despite being ruled by Muslim empires for hundreds of years. What accounts for these differences?
Follow up question: what beliefs/religions were being practised in those countries at the time of invasion?
I won't be in a position to answer the first half, which pertains to the Middle East and North Africa becoming majority Muslim. I can certainly answer the second half related to India still remaining 80% Hindu.
There are three basic aspects which helped Hinduism survive: the large population, the caste system, and the flexible nature of Hinduism.
The population of India, which has marred its progress, has played a major role in this case. India has always been populous. Converting a large population en-mass was always difficult.
Let us assume the might of an Emperor wanting to convert his subjects is high. But this has to be met with the willingness of the subjects. Hinduism by nature is an accommodative religion. In fact the nature of 'religion' as was known to the West was not known to Indians a thousand years ago. Even with this nature, Hindus resisted the idea of abandoning older traditions and accepting new ones. Another evil of Indian society came to help here. The Caste System. A Hindu has at least two simultaneous identities. He belongs to the Hindu fold as well as to his caste. His Hindu identity could be diffuse, but the caste identity was extremely strong. He has had to adhere to certain social norms specific to his caste. These were at times and places set down and governed by a very rigid and conservative caste council called as Jaati Panchayat. Any deviation could attract penalty of a social boycott. The fear of this boycott was strong, but it held people together.
Another aspect that helped Hinduism was its flexible nature. Hinduism has never been averse to change. The Vedic principles gave way to Buddhist principles. The Vedic ideas saw a revival with the likes of Shankarachrya. These people brought back the knowledge of the Upanishads in the main fold. This phase coincided with the birth and spread of Islam in the Middle East. By the time Islam reached India, the traditions of Shankarachrya had transformed into the Bhakti Movement. The poet saints of this Movement presented the knowledge of the complex Vedas, Upanishads and the Gita to the common man, in a manner they could understand and relate to it. This movement ensured a very strong connect of the masses with the ancient knowledge base of the land. It would have been difficult to erase this connect for any Islamic ruler.
If you have a close look, all three aspects work best collectively. Singularly they stand less chance of resistance. They just reinforce each other.
The answer is based on writings by Amartya Sen, Sashi Tharoor and Ramchandra Guha.