At the second coming God's people will be taken to heaven. It's in the Bible, I Thessalonians 4:16-17, NIV. "For the Lord Himself will come down from heaven, with a loud command, with the voice of the archangel and with the trumpet call of God, and the dead in Christ will rise first. After that, we who are still alive and are left will be caught up with them in the clouds to meet the Lord in the air. And so we will be with the Lord forever."
At the time of the second coming of Christ the wicked are overwhelmed with terror and despair. It's in the Bible, Revelation 6:16-17, NIV. "They called to the mountains and the rocks, 'Fall on us and hide us from the face of Him who sits on the throne and from the wrath of the Lamb! For the great day of their wrath has come, and who can stand?"
The leader of the wicked is destroyed with the brightness of Christ's coming and the rest of the wicked are killed by His sword. It's in the Bible, II Thessalonians 2:8, NIV. "And then the lawless one will be revealed, whom the Lord Jesus will overthrow with the breath of his mouth and destroy by the splendor of his coming." Revelation 19:21, NIV says, "The rest of them were killed with the sword that came out of the mouth of the rider on the horse."
Since the righteous ascend to be with the Lord and the wicked are destroyed at His appearing, the earth stands for a time without human inhabitants. It's in the Bible, Jeremiah 4:23-25, NIV. "I looked at the earth, and it was formless and empty; and at the heavens, and their light was gone. I looked at the mountains, and they were quaking; all the hills were swaying. I looked, and there were no people; every bird in the sky had flown away."
The wicked remain in their graves for a thousand years. It's in the Bible, Revelation 20:4-5, NIV. "[God's people] came to life and reigned with Christ a thousand years. (The rest of the dead did not come to life until the thousand years were ended.)"
While the saints are in heaven and the wicked are dead, the devil is confined to the desolate earth for 1000 years. It's in the Bible, Revelation 20:1-3, NIV. "And I saw an angel coming down out of heaven, having the key to the Abyss and holding in his hand a great chain. He seized the dragon, that ancient serpent, who is the devil, or Satan, and bound him for a thousand years. He threw him in the Abyss, and locked and sealed it over him, to keep him from deceiving the nations any more until the thousand years were ended. After that, he must be set free for a short time."
At the close of the 1000 years the holy city of God will descend from heaven to earth. It's in the Bible, Revelation 21:1-3, NIV. "Then I saw a new heaven and a new earth, for the first heaven and the first earth had passed away, and there was no longer any sea. I saw the Holy City, the new Jerusalem, coming down out of heaven from God, prepared as a bride beautifully dressed for her husband. And I heard a loud voice from the throne saying, 'Now the dwelling of God is with men, and He will live with them. They will be His people, and God Himself will be with them and be their God."
With the wicked resurrected and Satan released they attempt to take the city of God. It's in the Bible, Revelation 20:7-9, NIV. "When the thousand years are over, Satan will be released from his prison and will go out to deceive the nations in the four corners of the earth—Gog and Magog—to gather them for battle. In number they are like the sand of the seashore. They marched across the breadth of the earth and surrounded the camp of God's people, the city he loves."
Then they are destroyed by hell fire. It's in the Bible, Revelation 20:9, NIV. "But fire came down from heaven and devoured them."