Why is Satan loosed after the thousand years?
Scripture teaches that at the end of the thousand years Satan is released from the bottomless pit specifically to go out and deceive the nations of the earth, gathering them into a final rebellion against God that leads to their complete destruction and his own final judgment.
When the thousand years are finished, Satan is loosed out of his prison so that he can go out and deceive the nations in the four quarters of the earth, gathering them together for one last battle. Revelation 20:7-8 says, "And when the thousand years are expired, Satan shall be loosed out of his prison, and shall go out to deceive the nations which are in the four quarters of the earth, Gog, and Magog, to gather them together to battle: the number of whom is as the sand of the sea." His release is not a defeat for God's plan but part of the sequence that brings history to its final close.
This gathering shows that even after a thousand years of peace under Christ's reign, there remain nations who will follow Satan's deception the moment he is loosed. They march against Jerusalem, the beloved city, but their rebellion is short lived. Fire comes down from God out of heaven and devours them, and Satan himself is then cast into the lake of fire and brimstone, where the beast and the false prophet already are, to be tormented day and night forever and ever.
So the loosing of Satan serves as the final test and the final judgment of the nations that remained on the earth through the Millennium. It leads directly into the White Throne Judgment, the resurrection of the wicked dead, and then the new heaven and new earth, when the tabernacle of God comes down to dwell with His people forever.
The scriptures
And when the thousand years are expired, Satan shall be loosed out of his prison, And shall go out to deceive the nations which are in the four quarters of the earth, Gog and Magog, to gather them together to battle: the number of whom is as the sand of the sea. And they went up on the breadth of the earth, and compassed the camp of the saints about, and the beloved city: and fire came down from God out of heaven, and devoured them. And the devil that deceived them was cast into the lake of fire and brimstone, where the beast and the false prophet are, and shall be tormented day and night for ever and ever.
And I saw a great white throne, and him that sat on it, from whose face the earth and the heaven fled away; and there was found no place for them. And I saw the dead, small and great, stand before God; and the books were opened: and another book was opened, which is the book of life: and the dead were judged out of those things which were written in the books, according to their works.
And I saw a new heaven and a new earth: for the first heaven and the first earth were passed away; and there was no more sea. And I John saw the holy city, new Jerusalem, coming down from God out of heaven, prepared as a bride adorned for her husband. And I heard a great voice out of heaven saying, Behold, the tabernacle of God is with men, and he will dwell with them, and they shall be his people, and God himself shall be with them, and be their God.
From the books
This answer is drawn from these passages in the Mary Banks Faith Library.