This article cites a midrash about David's death that I've heard a few times:
Basically the angel of death kills him in the split second he’s not learning Torah because he slips on a stair. Does anyone know where this midrash can be found?
What did David do? Every Shabbat he would sit and learn all day long to protect himself from the Angel of Death. On that day on which the Angel of Death was supposed to put his soul to rest, the day on which David was supposed to die, the Angel of Death stood before him and was unable to overcome him because his mouth did not pause from study. The Angel of Death said: What shall I do to him? David had a garden [bustana] behind his house; the Angel of Death came, climbed, and shook the trees. David went out to see. As he climbed the stair, the stair broke beneath him. He was startled and was silent, interrupted his studies for a moment, and died.