To understand the next two chapters, a touch of history might be helpful.
When Nebuchadnezzar died in the 560s B.C.:
a) His son Evil-Merodach took his place (2 Kings 25:27).
b) Neriglissar (Jeremiah 39:3), Nebuchadnezzar's son-in-law, killed him after about two years.
c) Labashi-Marduk took Neriglissar's place after about a four-year reign.
d) Nabonidus then became King Labashi-Marduk, holding the throne for only nine months.
e) Nabonidus spent most of his time outside Babylon, leaving his son Belshazzar within the city to rule.
f) Belshazzar was co-regent with Nabonidus and was in the city, while Nabonidus was north of the city trying to stop the advances of Cyrus, the Persian king advancing on Babylon.
[This above line of succession can be found within many books. For the most simple explanation, see The Bible Knowledge Commentary: An Exposition of the Scriptures (Vol. 1, p. 1344) by J. F. Walvoord & R. B. Zuck (Eds.).]
Nabonidus' attempts to stop Cyrus were unsuccessful, and while he was away fighting Belshazzar, his son was in the city, packed with years of supply ready for a long, enduring siege. Belshazzar's pride showed absolute contempt for Cyrus’ power as he took refuge in Babylon, believing any attempt to lay siege to the city futile.
The history of the final rulers of Babylon depicts an unsteady empire in the hands of power-hungry men who loved position and wealth more than their country. These rulers allowed Babylon to deteriorate into a culture addicted to luxury and ease. In chapter 5, we watch the final gasps of a dying empire.
The material concerning Nabonidus and Belshazzar's relationship comes from Nabonidus, Belshazzar, and the Book of Daniel: An Update, by William Shea and The Persian Verse Account of Nabonidus, first published by Sidney Smith.
The Feast (1-5)
Daniel 5 was written during that historical time when Cyrus was advancing just outside Babylon, working to divert the Euphrates. Inside, Belshazzar was deceived into thinking the Babylonian gods had been offended, so to rally the favor of the gods, he threw a religious and pagan feast. As Belshazzar became more and more inebriated, he decided to have the vessels Nebuchadnezzar had taken from Solomon's temple, some decades previous, brought out to use to get his guests and harem even further drunk.
Nebuchadnezzar was not Belshazzar's father in a biological sense but in a political one. So the scene is set: Belshazzar was seeking to appease the Babylonian gods, while at the same time disparage Yahweh, whom Nebuchadnezzar had defined as the God of the whole world (1-4).
The Writing on the Wall (5-12)
In the midst of their drunkenness and sacrilege, a hand appeared suspended between earth and heaven. It was not attached to a body, and it was using a lamp stand as a sort of spotlight on the wall (5). As the hand began to write on the same wall, Belshazzar was stricken with terror and had to take a seat (6).
Belshazzar then called for his enchanters to interpret what was written on the wall, making an empty pledge to the one who could translate the inscription:
a) They would be elevated to nobility.
b) They would be given the status of a high-ranking official.
c) They would be made third in succession under Belshazzar, behind the co-rulers of Nabonidus and Belshazzar.
There was little hope of Belshazzar ever keeping this commitment, realizing the nearness of Cyrus to the city and the defeat of the army of the co-regent Nabonidus (7). The enchanters came, contemplated, and studied, but had no idea what the words on the wall meant. Belshazzar grew even more terrified (7-9).
Belshazzar's mother was told of what was happening and entered the feast sober and composed, older and wiser. She first honored her son, then consoled her son, and finally reminded her son of a holy man with supernatural insight. It was the holy man Nebuchadnezzar had made the chief of the enchanters, Daniel, who had been renamed Belteshazzar (10-11).
It would seem the man who could interpret dreams and resolve enigmas had been retired, made obscure, or made irrelevant and buried in some meaningless business. For whatever reason, Belshazzar had forgotten the once-renowned Daniel. The queen assured the king that Daniel would be up for the interpretation of the writing (12).
The Interpretation of the Writing (13-16)
Daniel was summoned, and Belshazzar rehearsed for Daniel all he knew about his life. He then laid out to Daniel the inability of the enchanters to interpret the text, which had been supernaturally written on the wall, the very enchanters whom Daniel had once governed (13-15).
Then Belshazzar told Daniel he had been given assurances that he could interpret the text and pledged Daniel the same rewards he had promised the enchanters if he could break the code (16).
Daniel made three points to Belshazzar before he interpreted the text:
a) Daniel told the king his supernatural gift of interpretation was not for sale (17).
b) Daniel reminded Belshazzar of Nebuchadnezzar, who had been a great king with much glory and majesty associated with his rule. He was so great that he made nations fear as he became the judge of all who lived and died (18-19). But through Nebuchadnezzar's greatness, his heart had hardened with pride, so God brought him low, driving him to suffer from social anxiety, zoanthropy, and clinical lycanthropy, driving him to the fields to act like and live like an animal. He acted and lived as such until Nebuchadnezzar repented and humbled himself and knew Yahweh as the Most High, Ultimate Ruler of all (20-21).
c) Daniel rebuked Belshazzar, who knew the history of Nebuchadnezzar because Nebuchadnezzar had written in his memoirs the circumstances of his conversion to Yahweh.
Daniel told Belshazzar that Nebuchadnezzar was his father, in the sense of being his political father, but he had in no way humbled himself like Nebuchadnezzar had humbled himself (22).
Instead, Belshazzar had mocked Yahweh by using temple vessels for a drunken feast. He additionally had paid homage to the images of his phony gods, while ignoring the God who held his life in His hands (23).
Daniel then went to interpreting the writing on the wall; "MENE, MENE, TEKEL, and PARSIN" (24-25). In strict word-for-word interpretation, the words meant:
numbered (MENE) numbered (MENE)
The interpretation of these words meant:
a) Yahweh had numbered the days of Belshazzar's kingdom, and it was now time for it to come to an end.
b) Yahweh had put Belshazzar on the scale, and he was found deficient, or as a person who could not be shown mercy.
c) Yahweh had decided to divide the kingdom, meaning it would be taken from Belshazzar and completely given to Cyrus, who was just outside the city gate (26-28)
Belshazzar made good on his promise and honored Daniel, who desired no payment.
Belshazzar Executed (30-31)
History indicates that on the night Babylon was overthrown, Cyrus' army diverted the Euphrates and entered the city through the river canal. When he had entered the city, a riotous feast was taking place. History further informs us that the Babylonian army mostly welcomed the Persians and treated them like liberators from the oppression of Belshazzar.
Belshazzar was executed, and Cyrus made Darius the Mede ruler of the city, while he marched on in conquest to the east.
For a brief and interesting synopsis of Cyrus' invasion of Babylon, see http://www.cyropaedia.org/book-7/chapter-7-5-cyrus-takes-babylon-by-rerouting-the-euphrates-and-entering-by-night-while-the-babylonians-are-in-celebration-he-transitions-from-a-general-into-a-king-by-worrying-about-how-to-maintain/