What signs are mentioned in the Quran that show that Imam Mahdi a.s will come soon and fight for justice. Also when he comes what will happen to earth and the humans living on it.

In surah Anbiya verse 105:

‎وَلَقَدْ كَتَبْنَا فِي الزَّبُورِ مِن بَعْدِ الذِّكْرِ أَنَّ الْأَرْضَ يَرِثُهَا عِبَادِيَ الصَّالِحُونَ

And certainly We wrote in the Book after the reminder that (as for) the land, My righteous servants shall inherit it.

It is narrated from Imam Baqir (as) that the righteous servants who will inherit the land will be Imam Mahdi and his followers.

Further more in surah Hud verse 86

‎بَقِيَّتُ اللَّهِ خَيْرٌ لَّكُمْ إِن كُنتُم مُّؤْمِنِينَ

What remains with Allah is better for you if you are believers,

In a narration from Imam Baqir (as), when Imam Mahdi will reappear, he will learn against the Kaaba and he will first recite this verse then he will say: 'I am the Baqiyatullah in the Earth and His (Allah) khalifa and His(Allah) Hujjat upon you.' Hence whoever wants to greet the Imam should say Assalamu alaika ya Baqiyatallahi find ardhihi.

In surah Hadeed verse 17:

‎اعْلَمُوا أَنَّ اللَّهَ يُحْيِي الْأَرْضَ بَعْدَ مَوْتِهَا قَدْ بَيَّنَّا لَكُمُ الْآيَاتِ لَعَلَّكُمْ تَعْقِلُونَ

Know that Allah gives life to the earth after its death; indeed, We have made the communications clear to you that you may understand.

Imam Sadiq (as) narrates

What is meant here is that Allah will revive the earth through the Justice of Imam Mahdi (as) during his dhuhoor after a period in which the people would have died due to the misleading leaders.

In Surah Qasas, verse 5

‎وَنُرِيدُ أَن نَّمُنَّ عَلَى الَّذِينَ اسْتُضْعِفُوا فِي الْأَرْضِ وَنَجْعَلَهُمْ أَئِمَّةً وَنَجْعَلَهُمُ الْوَارِثِينَ

And We desired to bestow a favor upon those who were deemed weak in the land, and to make them the Imams, and to make them the heirs,

Imam Ali says that what is meant by 'weak' is the family of the Prophet. After their endeavors and suffering, the Mahdi from this progeny will be raised and will take them to the peak of glory and dignity and will humiliate their enemies.