From time to time God reveals certain future events to certain people. In this case God gave Nebuchadnezzar a dream which caused him to seek out someone to interpret it. Daniel had faith that God would enable him to interpret the dream, and consequently God gave him a vision of the future events.
Dan 2:17-19 Then Daniel went to his house and made the matter known to Hananiah, Mishael, and Azariah, his companions, (18) and told them to seek mercy from the God of heaven concerning this mystery, so that Daniel and his companions might not be destroyed with the rest of the wise men of Babylon. (19) Then the mystery was revealed to Daniel in a vision of the night. Then Daniel blessed the God of heaven.
Ol' Neb was impressed:
Dan 2:46-47 Then King Nebuchadnezzar fell upon his face and paid homage to Daniel, and commanded that an offering and incense be offered up to him. (47) The king answered and said to Daniel, “Truly, your God is God of gods and Lord of kings, and a revealer of mysteries, for you have been able to reveal this mystery.”
Samuel was a prophet of significance. He foretold many things including this:
1Sa 8:10-18 So Samuel told all the words of the LORD to the people who were asking for a king from him. (11) He said, “These will be the ways of the king who will reign over you: he will take your sons and appoint them to his chariots and to be his horsemen and to run before his chariots. (12) And he will appoint for himself commanders of thousands and commanders of fifties, and some to plow his ground and to reap his harvest, and to make his implements of war and the equipment of his chariots. (13) He will take your daughters to be perfumers and cooks and bakers. (14) He will take the best of your fields and vineyards and olive orchards and give them to his servants. (15) He will take the tenth of your grain and of your vineyards and give it to his officers and to his servants. (16) He will take your male servants and female servants and the best of your young men and your donkeys, and put them to his work. (17) He will take the tenth of your flocks, and you shall be his slaves. (18) And in that day you will cry out because of your king, whom you have chosen for yourselves, but the LORD will not answer you in that day.”