To understand what is being communicated in a text, one must first establish a foundation to which meaning can be anchored. This principle is relevant regardless of the type of text: narrative, exposition or argument.
The writer of 1 Samuel 15:29 (KJV throughout) relates:
And also the Strength of Israel will not lie nor repent: for he is not a man, that he should repent.
The text indicates these words are Samuel's, and that he was speaking to Saul. So, there are five entities that are connected by the dialogue:
- The author
- God: the Strength of Israel.
Anchor point 1: the author, if he is not Samuel, has the same purpose as Samuel
The author and Samuel may be one and the same, but whether they are or aren't is of little consequence, since the author is passing on Samuel's words and Samuel's feelings. We can either assume that the author's purpose is the same as Samuel's, or that it's different.
My answer assumes the author and Samuel had the same purpose in writing/preserving/communicating this passage - i.e. to let the readers know something important about Israel, Saul and God.
Others are free to answer from the other perspective, if they are so moved.
Anchor point 2: The author determines who the good guys and bad guys are.
It's important to distinguish the good guys from the bad guys in a text, since different meanings can be inferred according to whether the subject being referred to in a passage is a friend or a foe.
The text clearly portrays Samuel and God as white hat wearing good guys, and Saul as a character who looked, initially, as though he was wearing a white hat, but eventually the whitewash cracked to show the true colour of the hat underneath.
Samuel esteems God and reproves Saul.
The meaning of Strength (Glory)
The word "Strength" in the expression "Strength of Israel" comes from the Hebrew word (netsach), which means perpetuity, confidence, completeness, truth, glory. So, God is the sustenance upon which Israel's existence depends. Moses, in Deuteronomy 32:47, says it like this (emphasis mine):
Set your hearts unto all the words which I testify among you this day, which ye shall command your children to observe to do, all the words of this law. For it is not a vain thing for you; because it is your life: and through this thing ye shall prolong your days in the land, whither ye go over Jordan to possess it.
The meaning of Repent
According to Gesenius, the Hebrew word for "repent" in the given text, comes from a root that means "to groan" (nacham). The cause of the groaning might be grief, sorrow, pity, compassion, or consolation, and the direction of such emotions can be inward or outward.
Now, Samuel says that God, "... will not lie nor repent: for he is not a man, that he should repent.". Of course, he is echoing the words of Balaam from Numbers 23:19, who was compelled to deliver to Balak God's words exactly as they were given to him.
God is not a man, that he should lie; neither the son of man, that he should repent: hath he said, and shall he not do it? or hath he spoken, and shall he not make it good?
Here we have the complete explanation of how God is not like men - i.e. What He says, He will do! According to the narrative of scripture, God's word is immutable, which makes him different to men, who can be coerced by various forces.
To extract any consistent meaning from the words of scripture, one must step into the shoes of the character whose words have been given, and from there determine what light might be shed upon the question by other passages.
Given what Gesenius says concerning "repent" (nacham), and what Samuel says concerning God, what can be concluded about what it means for God to "repent" of something?
In the narrative, could it mean:
God made a mistake in choosing the descendants of Abraham as the recipients of His Law, and He grieves for His foolishness?
God did not make a mistake, but mulls over Israel's stiff-necked disobedience and comforts himself by contemplating the evil He intends to bring upon the people?
God did not make a mistake, but needs to be comforted because His children simply refuse to do as they are told.
God did not make a mistake by giving Israel/Man the capacity to do as he pleases, and is grieved to His core that he stubbornly refuses to rule over his natural inclinations for the sake of the fruit of his loins. God pities and groans for the children of those who cannot join the dots between behaviour and the apprehension of life and good, death and evil (Deuteronomy 30:11-14).
There is no doubt that Samuel would have picked option 4, above, as what it means for God to "repent" of something. He understood God's grief in this regard perfectly well, since he felt it in his own heart. He would, himself, have repented of ever bringing his sons into the world because of the suffering they perpetrated on the people, together with the shame they brought to his name and the name of his God. 1 Samuel 8:3 records:
And his sons walked not in his ways, but turned aside after lucre, and took bribes, and perverted judgment.
However, such is the cost of giving one's children a free hand to do as they please.
There is no contradiction in the passage the OP has presented. One simply has to understand the full meaning of the word "repent" and how the author of the text applies it to the character of God, as he perceives him.