Haman was about to receive something of a shock, and once again we see God working through the smallest details. The king could not sleep, so he had two books of chronicles of the kingdom brought in to read. Perhaps he thought this would help him to sleep! Now remember that back at the beginning of the book when Mordecai had reported a plot to assassinate the king it had been recorded in the chronicles. So Xerxes came upon the incident and he asked if Mordecai had ever been honoured for this action. Nothing had been done.
Now note this. Mordecai had done good, but for a time it seemed as if he he had received no reward. Yet a reward would come, and it would come at such a time as to save the whole Jewish people. We should always seek to do the right thing. Many times it can seem pointless, or we can feel so fed up and adopt a grumpy attitude, giving up on doing good. As Paul says in Galatians, we should never tire of doing good. God is always watching and knows exactly what He is doing.
The king speaks to Haman and asks him for his advice on how to honour someone, Haman thinks it he himself who will be honoured. So he thinks up a grand reward, then discovers to his horror that it is Mordecai who will receive the honour.
God is in control of all things.