Chronologically, between chapters 38 and 39, we would find 21-14; 27-29; and 32.
v1-2: Nebuchadnezzar had besieged the city for 18 months. Even this was part of God’s judgment, as the people endured a severe lack of food.
v3: The princes of Babylon sat in the Middle Gate, claiming victory and authority, and giving Zedekiah an opportunity to surrender.
v4: Instead of surrendering to the princes, as advised by Jeremiah (38.17-18), Zedekiah fled. But since there were Babylonian troops throughout Judah, he was unlikely to escape.
v5-7: Zedekiah could not escape. He was captured, brought to Riblah, where his sons were killed, and his eyes put out. Hen he was taken to Babylon; another foreign king to be displayed before the crowds.
v8: Jerusalem burned, and its walls broken down.
v9: People taken to Babylon; those who had defected were kept safe.
v10: The very poorest people were left to tend vineyards and fields.
v11-12: Jeremiah was treated more kindly by Nebuchadnezzar then by the Jews, see also 40.4. Even so, the Babylonians kept Jeremiah under watch, perhaps being suspicious of him.
v13-14: Jeremiah dwelt among his own people; this was something he had always done, and he had no command from God to do anything else.
Gedaliah was made governor of Judah and Jerusalem, see 40.5.
v15-18: Ebed-Melech was blessed for Jeremiah’s sake, and for his trust in the Lord. He would be delivered from the judgment that was to fall. This promise actually preceded the fall of the city.