This is a generalization from this question on finger of death, but I do not think it is a duplicate. The answer to that question hinges on this one, but they are ultimately separate.
Using Finger of Death(FoD) as our example:
Character A is making death saving throws due to FoD from Character B.
Character A has 2 Death saving throw failures.
Character C attacks character A, causing an automatic Death Saving Throw failure and the Character A subsequently Dies.
Finger of Death states:
A humanoid killed by this spell rises at the start of your next turn as a zombie that is permanently under your command…
In order for that clause to trigger, does Character A have to fail 3 death saving throws? Or would any death occurring after the FoD be the cause of Character A's death (specifically another creature 'finishing' Character A before the final death save from FoD occurs?)
In other words, did Character A die from failing death saving throws (which was caused by FoD), or did Character A die from taking damage from Character C (which resulted in the final death saving throw failure from FoD)?
Best Answer
Whatever effect causes the last death saving throw to fail is what causes the death
General case
Until a creature has failed their last death saving throw, nothing has killed them; they are still "clinging to life". Thus, only an effect that causes you to fail your last death saving throw (or kills you instantly) can be said to have actually killed you.
Jeremy Crawford has also agreed with this:
Specific case: finger of death
Finger of death says:
Thus, only when the spell was the final cause of death of the creature does its effect take place.
So as an example, say finger of death brings a creature down to 0 hp but does not kill them instantly. Then, the as the round proceeds, the creature gets hit once by three different enemies. In this case, it does not matter what dropped the creature to 0 hp. The effect that killed the creature was the attack of the third enemy. That was the effect that made the character cross the line from alive to dead. Everything else before that was just preamble. So, in this case, finger of death's effects would not take place and the character would not rise as a zombie.
Another example: Say a character is at 0 hp with two death saving throws failed. Then an enemy casts finger of death on them and they take damage. In this case, the enemy does die from finger of death and rises as a zombie accordingly.