The gods of the Homeric epics are anthropomorphic, which means, among other things, that they behave like human beings. Given this behavior, they also choose sides and play favorites like human beings.
Some divinities have children who are involved in the war. The goddess Aphrodite, for example, was the mother of the Trojan warrior Aeneas. The sea goddess Thetis was the mother of the Greek warrior Achilles. The god Zeus was the father of the Trojan warrior Sarpedon, whom Achilles' friend Patroclus kills in Iliad 16.
Other divinities were angry with one side or the other. According to tradition that appears outside of the Iliad, Hera and Athene were angry with the Trojan Paris (and therefore all Trojans) because Paris chose Aphrodite as the most beautiful goddess instead of one of them.
Other divinities seem to favor one side and then another. In Iliad 4, the Greek warrior Menelaus is called "beloved of Ares" (A.S. Kline translation), but in Iliad 5, Ares fights against the Greek warrior Diomedes.
In Iliad 20, when numerous divinities head for the battlefield, Homer gives the following catalogue:
"Hera headed for the ships, with Pallas Athene, Poseidon, Encircler of Earth, Hermes the Helper, he of quicksilver mind, and Hephaestus the lame, with his powerful shoulders, his withered legs still moving nimbly. Meanwhile Ares of the gleaming helm took the Trojan side, with Phoebus of the flowing locks, Artemis the Archer, Leto, Xanthus’ stream, and laughter-loving Aphrodite" (A.S. Kline translation).
The first part of this catalogue (in bold) fights for the Greek side, whereas the second half of the catalogue (in italics) fights on the Trojan side in this instance.