The Iliad ends with a funeral, not with the fall of Troy. The last book, XXIV, begins with Achilles dragging Hector's body every day around the tomb of Patroclus, while the gods protect the corpse. Zeus sends the goddess Thetis to persuade her son to accept the ransom.
Guided by the god Hermes, the aged King Priam crosses the Greek camp at night and reaches Achilles' tent. He kisses the hand of the man who killed his sons: "I endured what no other mortal on earth has yet endured: to bring to my lips the hand of the man who murders my sons." Achilles thinks of his own father, and the two weep: "one, for Hector the man-slayer, wept long, prostrate before the feet of Achilles; Achilles, in turn, wept for his father, and at other times for Patroclus."
Achilles returns the body, shares a meal with Priam, and grants eleven days of truce for the funeral. In Troy, Andromache, Hecuba, and Helen lament Hector, the body is burned, the bones go into a golden urn, the tomb is raised, and the people hold a feast in the palace of Priam. The last line is: "so they performed the funeral rites of Hector, tamer of horses."
The ending is read in two ways. For some readers, it is the reconciliation of two enemies who discover the same grief. For others, nothing is resolved: Achilles knows he will die soon, the truce lasts only eleven days, and the city, which Andromache foresees taken, has not yet fallen. The poem leaves Troy standing and the reader knowing what comes next.