Karna's death in the Mahābhārata is brought about by a number of factors. The first and foremost contributor was the sage Durvasa himself. While blessing Kunti with a mantra by which she could call upon any god of her choice, he did not tell her the likely consequence of this incantation. Karna's upbringing by the charioteer Adiratha denied the young warrior his rightful recognition as a man of Kshatriya status. And it was Lord Indra, in fact, who, in the form of a giant bee, stung Karna's thigh and caused the guru Parasurama to curse Karna with such a significant curse, for lying about his caste. It was later revealed that Parasurama knew about the impending massacre at Kurukshetra; he explained to Karna in a dream, on the night before Karna's battle with Arjuna, that he purposely cursed him in that way so as to ensure the defeat of the Kauravas. In this dream, he blesses Karna with everlasting glory after his death, because of his humble acceptance of the curse.
Having embarked upon the fateful battle, the curse of the Brahmin who owned the cow and the curse of Bhoomidevi provide the opportunity for Karna's defeat. His giving away of his armour and earrings as alms to Lord Indra, this time disguised as a beggar, left him vulnerable. His generous nature and faith in keeping his word also contributed to his downfall by the two promises he made to his mother Kunti, not to kill his four half-brothers and to use the Nagastra only once.
Karna's hatred towards the Pandavas lessened when he learned from his mother that they were his half-brothers. But, to be loyal to Duryodhana, Karna decided to fight against Arjuna in the war. Karna supported Duryodhana in all his wrongdoings even though he knew the difference between good and evil perfectly well. Lord Krishna tried to persuade Karna to switch his allegiance, knowing that without his support, Duryodhana would not fight the war and millions of lives would be spared. But Karna refused to do so because of his personal honour and his debt to Duryodhana. This resulted in Lord Krishna's apathy towards Karna, which ultimately led to Krishna's fatal instruction to Arjuna to kill Karna without mercy, just as Karna and his army had shown no remorse while killing Abhimanyu.