Why did Ghatotkach have to die in the Mahabharata? Was it because his mother was a demon?
The sacrifice made by Ghatotkacha was exactly similar to the sacrifice made by Abhimanyu and his death had nothing to do with his mother being of the Rakshasa race. As sons of Pandavas they were glad to support their fathers in the Great War and of course one who dies a heroic military death is supposed to attain great merit in the afterlife. According to the Mahabharata,
Ghatotkacha the son of Bheema descended upon the Kaurava army like a horror of thousand demons amplified by black magic, becoming unstoppable by night. He threatened to destroy the army and Karna was forced to kill him with the one-time-use divine weapon of Indra which he had been 'saving' for Arjuna. The huge Rakshasa fell crushing thousands of enemy soldiers under his massive bulk. Bheema was disconsolate at the loss of his son but Lord Krishna made them understand that the brave Ghatotkacha had made a great sacrifice for his uncle and opened the way for the Pandavas' eventual victory (paraphrase from the oral tradition which most of us have heard as Indians)
In short nobody survived the Bharata War except the Pandavas, Krishna, Satyaki, Yuyutsu and the "Chiranjeevi Trio." These persons too had to "sacrifice" a great deal by the finish: the Pandavas lost their sons and the Chiranjeevis lost their honor (Kripa, Kritavarma and Ashwatthama, of whom Kritavarma was no chiranjeevi; he was ironically killed by Satyaki at the twilight of the Yadava race, according to Wikipedia); Yuyutsu lost an uncle, 100 brothers and all his illusions of righteous conduct; and for Satyaki and Lord Krishna the ultimate sacrifice was Gandhari's curse that eventually ended the Yadava race. The role of every other soldier including Ghatotkacha was to sacrifice their life for the grand purpose of Dharma and the Divine Plan.