In the controversy over who is the true King (David vs. Saul), David appeals for God’s ruling. David has plenty of chances to kill Saul, but doesn’t – while Saul is constantly trying to kill David. In the face of this, David declares God to be the true King (v. 7), and asks that he do what is just: to let the wicked fall into their own weaponry (which Saul literally does in I Samuel 31).
David does not ask God to lift him up as king – instead he asks the LORD to “arise” as king (v. 6). He is asking for justice, not revenge (v. 17).