Karna's death is arranged years in advance by things he did himself, and the epic sets each of them out. Refused instruction as a charioteer's son, he goes to Parashurama and says he is a brahmin. Parashurama teaches him the great weapons, then sleeps in his lap while an insect bores into Karna's thigh; the boy does not move, the blood wakes the teacher, and no brahmin could bear that much pain so calmly. The curse is exact: the weapons will fail him when he most needs them, because the mantra will not come.
The second is smaller and crueller. Practising, he kills a cow by accident, and its owner curses him that his chariot wheel will sink into the earth at the hour his life depends on it.
The third loss he chooses. Born with golden armour and earrings grown into his skin, he is asked for them by Indra, disguised as a beggar and acting to protect Arjuna, and gives them because he has vowed to refuse no one who asks at that hour. He takes in exchange a spear that will kill once, and spends it on Ghatotkacha.
Then Kunti comes to him before the war, tells him who he is, and asks for his sons. He promises to kill none of them but Arjuna, so that she will have five either way. On the seventeenth day the wheel sinks, the mantra will not come, and Arjuna shoots him while he is lifting it. Every one of the four traps was set by a promise Karna kept.