A question was asked earlier about Classical India and its lack of empires, and this made me wonder why Northern India was so susceptible to foreign raids and occupation.
The Turks of the Delhi Sultanate & Mughal Empire ruled Northern India for nearly 700 years and prior to that it had been subject to constant raids by Turks and Persians for nearly 300 years.
I know little of Indian history, but this modern population density map of India shows that Northern India is one of the most populated regions of the country: http://i.imgur.com/dCYU23n.png
Assuming Medieval India had a similar population spread, I find it surprising they weren't able to consolidate and adapt from centuries of Muslim raids.
Most of Northern India (aka Hindustan) is both fertile and flat, meaning it's both a rich target and difficult to defend. Being accessible (via Afghanistan) from the nomadic-raider-filled steppes of Central Asia didn't help either.