The difference between Saul and David was that one offered insincere repentance while the other expressed true repentance. In David's case, we have Psalm 51 as a window into his heart.
It is instructive to look at other Biblical leaders who sinned, and what happened afterwards.
- Moses struck the rock in anger, and his punishment was that he would not live to enter the Promised Land. Moses accepted God's punishment and continued to serve. Though he did not enter the land, God's presence remained with him, and that was more precious to Moses than any material reward, showing his heart. See Exodus 33:
14 The Lord replied, “My Presence will go with you, and I will give
15 Then Moses said to him, “If your Presence does not go with us, do
not send us up from here. 16 How will anyone know that you are pleased
with me and with your people unless you go with us? What else will
distinguish me and your people from all the other people on the face
of the earth?”
17 And the Lord said to Moses, “I will do the very thing you have
asked, because I am pleased with you and I know you by name.”
18 Then Moses said, “Now show me your glory.”
- Hezekiah, in pride, showed the emissary of Babylon the treasury of Judah. God pronounced judgment against him and told him that he would die. Hezekiah repented, and God mercifully extended his life fifteen years, but years later, all that wealth was plundered by foreign armies.
- The last King before the Exile was Jehoiachin. Here is what Jeremiah had to say about him:
24 “As surely as I live,” declares the Lord, “even if you,
Jehoiachin son of Jehoiakim king of Judah, were a signet ring on my
right hand, I would still pull you off. 25 I will deliver you into the
hands of those who want to kill you, those you fear—Nebuchadnezzar
king of Babylon and the Babylonians.[d] 26 I will hurl you and the
mother who gave you birth into another country, where neither of you
was born, and there you both will die. 27 You will never come back to
the land you long to return to.”
28 Is this man Jehoiachin a despised, broken pot,
an object no one wants? Why will he and his children be hurled out,
cast into a land they do not know? 29 O land, land, land,
hear the word of the Lord! 30 This is what the Lord says: “Record this man as if childless,
a man who will not prosper in his lifetime, for none of his offspring will prosper,
none will sit on the throne of David
or rule anymore in Judah.”
But what happened to this king? He did go into exile, but while there, he humbled himself before God and found favor in the court of the king of Babylon and his life was extended. He did have children, and though none sat on the throne, one descendant did become governor over Judah. This is what Haggai has to say about that man, Zerubbabel:
20 The word of the Lord came to Haggai a second time on the
twenty-fourth day of the month: 21 “Tell Zerubbabel governor of Judah
that I am going to shake the heavens and the earth. 22 I will overturn
royal thrones and shatter the power of the foreign kingdoms. I will
overthrow chariots and their drivers; horses and their riders will
fall, each by the sword of his brother.
23 “‘On that day,’ declares the Lord Almighty, ‘I will take you, my
servant Zerubbabel son of Shealtiel,’ declares the Lord, ‘and I will
make you like my signet ring, for I have chosen you,’ declares the
Numbered among his later descendants was Jesus Christ, the eternal king.
The pattern is that God's anger burns against a fallen leader and He pronounces a severe judgment, but if that leader's repentance is sincere, God walks back or delays part of the punishment. There is no guarantee that God's mercy will include retaining the title of kingship, as His purposes vary.
In Saul's case, what would true repentance have meant? Saul would have to acknowledge David as King and cede the throne willingly. That he would not do.
For a longer argument that defends the proposition that Saul's repentance was insincere, see https://www.ligonier.org/learn/devotionals/a-false-repentance/
This article refers to arguments made by Matthew Henry in his commentary, here summarized:
But Matthew Henry writes that “it is too evident that he only acts the part of a penitent, and is not one indeed.” To support his case, Henry notes, commenting on 1 Samuel 15:24-29:
Wrong audience. Saul makes his confession to Samuel only. He admits that he “ ‘transgressed the commandment of the Lord and [Samuel’s] words,’ ” but he asks only Samuel’s pardon, and that is not sufficient. He does not seem to grasp that Samuel was speaking for God, that his words were God’s.
Excuses. Saul excuses his fault, saying he feared the people and listened to them. But Henry notes that he never shrank before the people before.
Saving face. Saul is most interested in saving face. He asks Samuel to participate with him in a thanksgiving service and to honor him before the elders. He wants no one to know that God has rejected him as king.
The article goes on to show that by his words, Saul thought of God as Samuel's God, not his own, which is telling. He did not have a personal relationship.