Euripides dramatised Athena’s change of heart near the start of The Trojan Women:
Poseidon: Do you bring fresh tidings from some god, from Zeus, or from some lesser power?
Athena: From none of these; but on behalf of Troy, whose soil we tread, I have come to seek your mighty aid, to make it one with mine.
Poseidon: What! have you laid your former hate aside to take compassion on the town now that it is burnt to ashes?
Athena: First go back to the former point; will you make common cause with me in the scheme I purpose?
Poseidon: Yes, surely; but I want to learn your wishes, whether you have come to help Achaeans or Phrygians.
Athena: I wish to give my former foes, the Trojans, joy, and on the Achaean army impose a bitter return.
Poseidon: Why do you leap thus from mood to mood? Your love and hate both go too far, on whomever centred.
Athena: Do you not know the insult done to me and to the shrine I love?
Poseidon: I do: when Aias dragged away Cassandra by force.
Athena: Yes, and the Achaeans did nothing, said nothing to him.
Poseidon: And yet it was by your mighty aid they sacked Ilium.
Athena: For which cause I would join with you to do them harm.
Poseidon: My powers are ready at your will. What is your intent?
Athena: I will impose on them a return that is no return.
Poseidon: While they stay on shore, or as they cross the salt sea?
Athena: When they have set sail from Ilium for their homes.
Euripides (415 BCE). The Trojan Women 55–77. Translated by Edward P. Coleridge (1891).
‘Aias’ here is Ajax the Lesser. During the sack of Troy, Cassandra tried to claim sanctuary in the temple of Athena at Troy, but Ajax dragged her away and raped her.
There must have been at least two incompatible versions of the story, because in the passage above, Euripides has Poseidon say that Ajax dragged Cassandra out of Athena’s temple in Troy, but pseudo-Apollodorus has more detail:
Helenus was forced to tell how Ilium could be taken, to wit, first, if the bones of Pelops were brought to them; next, if Neoptolemus fought for them; and third, if the Palladium, which had fallen from heaven, were stolen from Troy, for while it was within the walls the city could not be taken.
On hearing these things the Greeks caused the bones of Pelops to be fetched, and they sent Ulysses and Phoenix to Lycomedes at Scyros, and these two persuaded him to let Neoptolemus go. […] And Ulysses went with Diomedes by night to the city, and there he let Diomedes wait, and after disfiguring himself and putting on mean attire he entered unknown into the city as a beggar. And being recognized by Helen, he with her help stole away the Palladium, and after killing many of the guards, brought it to the ships with the aid of Diomedes.
[… the Greeks then built the wooden horse and sacked Troy …]
And the Locrian Ajax, seeing Cassandra clinging to the wooden image of Athena, violated her; therefore they say that the image looks to heaven.
Pseudo-Apollodorus. Epitome E.5.11–14 and 23. Translated by James Frazer (1913).
The “wooden image of Athena” is the Palladium, but since it had been stolen by the Greeks, how could Cassandra have later clung to it in the temple? Presumably pseudo-Apollodorus has edited multiple incompatible sources together here.