Dan 4:30-33 The king spoke, saying, "Is not this great Babylon, that I have built for a royal dwelling by my mighty power and for the honor of my majesty?" While the word was still in the king's mouth, a voice fell from heaven: "King Nebuchadnezzar, to you it is spoken: the kingdom has departed from you! And they shall drive you from men, and your dwelling shall be with the beasts of the field. They shall make you eat grass like oxen; and seven times shall pass over you, until you know that the Most High rules in the kingdom of men, and gives it to whomever He chooses." That very hour the word was fulfilled concerning Nebuchadnezzar; he was driven from men and ate grass like oxen; his body was wet with the dew of heaven till his hair had grown like eagles' feathers and his nails like birds' claws.
Nebuchadnezzar knew that it was God who appointed him as king and also made his kingdom great. He constantly gave glory to Yahweh. Yet with warnings of his pride, he still boasted of his own ability and might in making Babylon great. This is stealing His glory, which unfortunately many of our pastors and brethren are doing when they are successful.
The judgement of God was immediate; making him insane and lived amongst the animals in the field eating grass.
Note - Nebuchadnezzar was not demon possessed (don't try to cast demons out of him).
In Act 12;21-23, King Herod was immediately killed and eaten by worms for not giving glory to God.
Dan 4:34-35 And at the end of the time I, Nebuchadnezzar, lifted my eyes to heaven, and my understanding returned to me; and I blessed the Most High and praised and honored Him who lives forever: For His dominion is an everlasting dominion, and His kingdom is from generation to generation. All the inhabitants of the earth are reputed as nothing; He does according to His will in the army of heaven and among the inhabitants of the earth. No one can restrain His hand or say to Him, "What have You done?"
King Nebuchadnezzar, having suffered for seven years in inhuman conditions, realized his pride. Because he was a faithful servant, God chastised him giving him the opportunity to repent.
1Peter 4:1-2 Therefore, since Christ suffered for us in the flesh, arm yourselves also with the same mind, for he who has suffered in the flesh has ceased from sin, that he no longer should live the rest of his time in the flesh for the lusts of men, but for the will of God.
Brethren, King Nebuchadnezzar, knew that the chastisements were good for his pride. So when he praised and thanked God for all the humiliations and sufferings, he was restored back to all his former glory as the great king of Babylon.
Dan 4:36 At the same time my reason returned to me, and for the glory of my kingdom, my honor and splendor returned to me. My counselors and nobles resorted to me, I was restored to my kingdom, and excellent majesty was added to me.
Rom 8:28 And we know that all things work together for good to those who love God, to those who are the called according to His purpose.
Brethren, can we still praise and thank God in pains and sufferings from our terminal cancer, incurable diseases, bankruptcies, death of loved ones, failures in ventures, rejected, excluded, falsely accused, persecuted, etc. (or are you still blaming the devil)
Dan 4:37 Now I, Nebuchadnezzar, praise and extol and honor the King of heaven, all of whose works are truth, and His ways justice. And those who walk in pride He is able to put down.