Can the Khilafa be decided by Shura?
The first verse of Shura - Ali' Imran 3:159: Consult with them in the matter. Once you make a decision, put your trust in Allah.
Quran.com: Ali' Imran 3:159
Translation: Mufti Taqi Usmani

So, (O Prophet) it is through mercy from Allah that you are gentle to them. Had you been rough and hard-hearted, they would have dispersed from around you. So, pardon them, and seek Forgiveness for them. Consult them in the matter and, once you have taken a decision, place your trust in Allah. Surely, Allah loves those who place their trust in Him.

فَبِمَا رَحْمَةٍۢ مِّنَ ٱللَّهِ لِنتَ لَهُمْ ۖ وَلَوْ كُنتَ فَظًّا غَلِيظَ ٱلْقَلْبِ لَٱنفَضُّوا۟ مِنْ حَوْلِكَ ۖ فَٱعْفُ عَنْهُمْ وَٱسْتَغْفِرْ لَهُمْ وَشَاوِرْهُمْ فِى ٱلْأَمْرِ ۖ فَإِذَا عَزَمْتَ فَتَوَكَّلْ عَلَى ٱللَّهِ ۚ إِنَّ ٱللَّهَ يُحِبُّ ٱلْمُتَوَكِّلِينَ

Reference  : Quran: Ali' Imran 3:159

Note: Allah (swt) is speaking to an Authority he chose, the Prophet (ﷺ), instructing him to consult his companions in some affairs. However, the decision in these affairs lies with none but the Prophet (ﷺ). The verse cannot be interpreted to give anyone the right to appoint a khalif in the absense of the Prophet (ﷺ).

 
The second verse of Shura - As-Shuraa 42:38: Who conduct their affairs by consultation.
Quran.com: As-Shuraa 42:38
Translation: Tafheem-ul-Quran - Abul Ala Maududi

who obey their Lord and establish Prayer; who conduct their affairs by consultation, and spend out of what We have bestowed upon them;

وَٱلَّذِينَ ٱسْتَجَابُوا۟ لِرَبِّهِمْ وَأَقَامُوا۟ ٱلصَّلَوٰةَ وَأَمْرُهُمْ شُورَىٰ بَيْنَهُمْ وَمِمَّا رَزَقْنَهُمْ يُنفِقُونَ

Reference  : Quran: As-Shuraa 42:38

Note: The verse specifically states "their" affairs. Is the appointment of a Khilafah a personal affair? Let's observe the use of Khalifa elsewhere in the Quran to determine this.

 
According to the Quran who appoints the Khalifa?
Quran 2:30: I am appointing a khalifa in the earth
Quran: Al-Baqarah 2:30
Translation: Fadel Soliman, Bridges’ translation

And recall when yours Lord said to the angels, “I am appointing a khalifa in the earth.” They said, “Will You appoint in it someone who causes corruption in it and sheds blood, while we highly exalt You with praise and proclaim Your holiness?” He said, “Indeed, I know what you do not know.”

وَإِذْ قَالَ رَبُّكَ لِلْمَلَٓئِكَةِ إِنِّى جَاعِلٌۭ فِى ٱلْأَرْضِ خَلِيفَةًۭ ۖ قَالُوٓا۟ أَتَجْعَلُ فِيهَا مَن يُفْسِدُ فِيهَا وَيَسْفِكُ ٱلدِّمَآءَ وَنَحْنُ نُسَبِّحُ بِحَمْدِكَ وَنُقَدِّسُ لَكَ ۖ قَالَ إِنِّىٓ أَعْلَمُ مَا لَا تَعْلَمُونَ

Reference  : Quran: Al-Baqarah 2:30
 
Quran 38:26: O David! We have surely made you a khalifa in the land

Reference: Quran: Sad 38:26

Quran: Sad 38:26
Translation: Dr. Mustafa Khattab, the Clear Quran

˹We instructed him:˺ “O David! We have surely made you a khalifa in the land, so judge between people with truth. And do not follow ˹your˺ desires or they will lead you astray from Allah’s Way. Surely those who go astray from Allah’s Way will suffer a severe punishment for neglecting the Day of Reckoning.”

يَدَاوُۥدُ إِنَّا جَعَلْنَكَ خَلِيفَةًۭ فِى ٱلْأَرْضِ فَٱحْكُم بَيْنَ ٱلنَّاسِ بِٱلْحَقِّ وَلَا تَتَّبِعِ ٱلْهَوَىٰ فَيُضِلَّكَ عَن سَبِيلِ ٱللَّهِ ۚ إِنَّ ٱلَّذِينَ يَضِلُّونَ عَن سَبِيلِ ٱللَّهِ لَهُمْ عَذَابٌۭ شَدِيدٌۢ بِمَا نَسُوا۟ يَوْمَ ٱلْحِسَابِ
Reference  : Quran: Sad 38:26
 
Can Shura be used to appoint successors? Or does Allah make people successors?
Quran 35:39: It is He Who made you vicegerents in the earth.

Reference: Quran: Fatir 35:39

Quran: Fatir 35:39
Translation: Tafheem-ul-Quran - Abul Ala Maudud

It is He Who made you vicegerents in the earth. So whoever disbelieves will bear the burden of his unbelief. The unbelievers' unbelief adds nothing but Allah's wrath against them. The unbelievers' unbelief adds nothing but their own loss.

هُوَ ٱلَّذِى جَعَلَكُمْ خَلَٓئِفَ فِى ٱلْأَرْضِۚ فَمَن كَفَرَ فَعَلَيْهِ كُفْرُهُۖۥ وَلَا يَزِيدُ ٱلْكَفِرِينَ كُفْرُهُمْ عِندَ رَبِّهِمْ إِلَّا مَقْتًۭاۖ وَلَا يَزِيدُ ٱلْكَفِرِينَ كُفْرُهُمْ إِلَّا خَسَارًۭا
Reference  : Quran: Fatir 35:39
 
Quran 27:62: It is other than Allah who makes you sucessors in the Earth?

Reference: Quran: An-Naml 27:62

Quran: An-Naml 27:62
Translation: Dr. Mustafa Khattab, the Clear Quran

Or ˹ask them,˺ “Who responds to the distressed when they cry to Him, relieving ˹their˺ affliction, and ˹Who˺ makes you successors in the earth? Is it another god besides Allah? Yet you are hardly mindful!”

أَمَّن يُجِيبُ ٱلْمُضْطَرَّ إِذَا دَعَاهُ وَيَكْشِفُ ٱلسُّوٓءَ وَيَجْعَلُكُمْ خُلَفَآءَ ٱلْأَرْضِ ۗ أَءِلَهٌۭ مَّعَ ٱللَّهِ ۚ قَلِيلًۭا مَّا تَذَكَّرُونَ
Reference  : Quran: An-Naml 27:62
 
Quran 6:165: He is the One Who has placed you as successors on earth and elevated some of you in rank over others

Reference: Quran: Al-An'am 6:165

Quran: Al-An'am 6:165
Translation: Dr. Mustafa Khattab, the Clear Quran

He is the One Who has placed you as successors on earth and elevated some of you in rank over others, so He may test you with what He has given you. Surely your Lord is swift in punishment, but He is certainly All-Forgiving, Most Merciful.

وَهُوَ ٱلَّذِى جَعَلَكُمْ خَلَٓئِفَ ٱلْأَرْضِ وَرَفَعَ بَعْضَكُمْ فَوْقَ بَعْضٍۢ دَرَجَتٍۢ لِّيَبْلُوَكُمْ فِى مَآ ءَاتَىٰكُمْ ۗ إِنَّ رَبَّكَ سَرِيعُ ٱلْعِقَابِ وَإِنَّهُۥ لَغَفُورٌۭ رَّحِيمٌۢ ‎
Reference  : Quran: Al-An'am 6:165

Note: Testing you with whether or not you accept and respect Allah's choice of those elevated in rank over others.

 
Quran 7:74: He made you inheritors after the people of 'Ad

Reference: Quran: Al-A'raf 7:74

Quran: Al-A'raf 7:74
Translation: Yusuf Ali

"And remember how He made you inheritors after the people of 'Ad and gave you habitations in the land: ye build for yourselves palaces and castles in (open) plains, and carve out homes in the mountains; so bring to remembrance the benefits (ye have received) from Allah, and refrain from evil and mischief on the earth."

وَٱذْكُرُوٓا۟ إِذْ جَعَلَكُمْ خُلَفَآءَ مِنۢ بَعْدِ عَادٍۢ وَبَوَّأَكُمْ فِى ٱلْأَرْضِ تَتَّخِذُونَ مِن سُهُولِهَا قُصُورًۭا وَتَنْحِتُونَ ٱلْجِبَالَ بُيُوتًۭا ۖ فَٱذْكُرُوٓا۟ ءَالَآءَ ٱللَّهِ وَلَا تَعْثَوْا۟ فِى ٱلْأَرْضِ مُفْسِدِينَ
Reference  : Quran: Al-A'raf 7:74
 
Quran 10:73: We saved him and those with him in the Ark and made them successors

Reference: Quran: Yunus 10:73

Quran: Yunus 10:73
Translation: Dr. Mustafa Khattab, the Clear Quran

But they still rejected him, so We saved him and those with him in the Ark and made them successors, and drowned those who rejected Our signs. See then what was the end of those who had been warned!

فَكَذَّبُوهُ فَنَجَّيْنَهُ وَمَن مَّعَهُۥ فِى ٱلْفُلْكِ وَجَعَلْنَهُمْ خَلَٓئِفَ وَأَغْرَقْنَا ٱلَّذِينَ كَذَّبُوا۟ بِـَٔايَتِنَا ۖ فَٱنظُرْ كَيْفَ كَانَ عَقِبَةُ ٱلْمُنذَرِينَ
Reference  : Quran: Yunus 10:73
 
Quran 10:14: We made you their successors in the land to see how you would act.

Reference: Quran: Yunus 10:14

Quran: Yunus 10:14
Translation: Dr. Mustafa Khattab, the Clear Quran

Then We made you their successors in the land to see how you would act.

ثُمَّ جَعَلْنَكُمْ خَلَٓئِفَ فِى ٱلْأَرْضِ مِنۢ بَعْدِهِمْ لِنَنظُرَ كَيْفَ تَعْمَلُونَ
Reference  : Quran: Yunus 10:14
 
Quran 7:69: Remember that He made you successors after the people of Noah.

Reference: Quran: Al-A'raf 7:69

Quran: Al-A'raf 7:69
Translation: Dr. Mustafa Khattab, the Clear Quran

Do you find it astonishing that a reminder should come to you from your Lord through one of your own so he may warn you? Remember that He made you successors after the people of Noah and increased you greatly in stature. So remember Allah’s favours, so you may be successful.”

أَوَعَجِبْتُمْ أَن جَآءَكُمْ ذِكْرٌۭ مِّن رَّبِّكُمْ عَلَىٰ رَجُلٍۢ مِّنكُمْ لِيُنذِرَكُمْ ۚ وَٱذْكُرُوٓا۟ إِذْ جَعَلَكُمْ خُلَفَآءَ مِنۢ بَعْدِ قَوْمِ نُوحٍۢ وَزَادَكُمْ فِى ٱلْخَلْقِ بَصْۣطَةًۭ ۖ فَٱذْكُرُوٓا۟ ءَالَآءَ ٱللَّهِ لَعَلَّكُمْ تُفْلِحُونَ
Reference  : Quran: Al-A'raf 7:69