You Guide Not Whom You Love but Allāh Guides Whom He Wills
An excerpt from Fath al-Majīd explaining the reason for revelation of this verse, the death of Abū Ṭālib upon the religion of ʿAbd al-Muṭṭalib.
Verily! You (‘O Muḥammad, ṣallallāhu ʿalayhi wa-sallam) guide not whom you love, but Allāh guides whom He wills. And He knows best those who are the guided.” I (Shaykh ʿAbd al-Raḥmān) say: The negated thing here is guidance of tawfīq and acceptance. For verily that matter is only for Allāh and He alone has power over that. And as for the guidance mentioned in the statement of Allāh taʿālá: "And verily you (‘O Muḥammad) are indeed guiding (mankind) to the straight path" this is referring to the guidance of showing and clarification. So he (ṣallallāhu ʿalayhi wa-sallam) clarifies matters regarding Allāh and he shows the way of His dīn and His legislation.
The reason for revelation of this verse is the death of Abū Ṭālib; upon the religion of ʿAbd al-Muṭṭalib. And further clarification will come with the ḥadīth of this chapter.And in the Ṣaḥīḥ, on the authority of Ibn al-Mūsáyyib from his father that he said, “When death was upon Abū Ṭālib, the Messenger of Allāh came to him while ʿAbdullāh ibn Abī Umayyah and Abū Jahl were with him. So he (ṣallallāhu ʿalayhi wa-sallam) said to him, "O my Uncle! Say, 'lā ilāha illallāh', a statement which I will use to argue on your behalf with Allāh." So they said to him, "Will you leave the religion of ʿAbd al-Muṭṭalib?" So the Prophet (ṣallallāhu ʿalayhi wa-sallam) repeated his statement and they repeated their statement. So that the last thing he said was: that he was on the religion of ʿAbd al-Muṭṭalib. He refused to say, 'lā ilāha illallāh', so the Prophet (ṣallallāhu ʿalayhi wa-sallam) said, "I will seek Allāh's forgiveness for you unless I am forbidden to do so." So Allāh azza wa jal revealed, "It is not proper for the Prophet and those who believe to ask Allāh's forgiveness for the Mushrikūn (polytheists) even though they be of kin. After it has become clear to them that they are the dwellers of the fire. (Because they died in a state of kufr.)"