Anarion the son of Elendil, younger brother of Isildur - how was he killed and when during the War of the Last Alliance did he die?
He was killed by a thrown rock in 3440 during the Siege of Barad-dur.
From Lord of the Rings, Appendix A, I: The Numenorean Kings, (iv) Gondor and the Heirs of Anarion:
There were thirty-one kings in Gondor after Anarion who was slain before the Barad-dur.
... and this from Appendix B, section The Second Age:
3434 The host of the Alliance crosses the Misty Mountains. Battle of Dagorlad and defeat of Sauron. Siege of Barad-dur begins.
3440 Anarion slain.
3441 Sauron overthrown by Elendil and Gil-galad, who perish. Isildur takes the One Ring. Sauron passes away and the Ringwraiths go into the shadows. The Second Age ends.
... and this from a footnote in Appendix A, I: The Numenorean Kings, (iii) Eriador, Arnor, and the Heirs of Isildur (hat-tip to @maguirenumber6 for the catch):
(for the helm of Anarion was crushed by the stone-cast [sic] from Barad-dur that slew him).
After the armies of the Last Alliance defeated Sauron's army at the gates of Mordor they passed into Mordor
and encompassed the stronghold of Sauron; and they laid siege to it for seven years, and suffered grievous loss by fire and by the darts and bolts of the Enemy, and Sauron sent many sorties against them. There in the valley of Gorgoroth Anárion son of Elendil was slain, and many others. [Akallabêth, Of the Rings of Power and the Third Age]
As you can see in this passage during a hard siege in which there was much loss Anárion along with many others perished whether by fire, darts, bolts, or by the troops who would come out to harrass the armies of the Alliance. Yet there is a note on the marks of royalty in the two kingdoms that says
The crown of Gondor was derived from the form of a Númenórean war-helm. In the beginning it was indeed a plain helm; and it is said to have been the one that Isildur wore in the Battle of Dagorlad (for the helm of Anárion was crushed by the stone cast from Barad-dûr that slew him). [Appendix A: The North Kingdom and the Dúnedain]
So he was slain by a stone which probably broke his neck, mashed his brains, or both. Again in Appendix A in Return of the King a passage notes that
There were thirty-one kings in Gondor after Anárion who was slain before the Barad-dûr. [Gondor and the heirs of Anárion]
Barad-dûr is the stronghold mentioned in the first quote that was under siege. Anárion was slain six years into that siege in 3440 of the Second Age.