How did Zeus influenced Odysseus?

Zeus hated Odysseus and was the cause of many of Odysseus's misfortunes. However, at the end of the story, when Odysseus returns to Ithaca, Zeus changes his mind about him and helps him defeat Penelope's suitors. this may have been because of Odysseus proving himself by perservering through 20 years away from home.