First sentences receive lots of attention when reading like a writer. They should.
Endings are harder to study because they are more dependent on the rest of the story. (One way to address this is to read much shorter stories and while that can have its own complications, I like it.)
Consider the ending of Shirley Jackson’s “The Lottery.” (Spoilers ahead.)
The children had stones already, and someone gave Davy Hutchinson a few pebbles.
Tessie Hutchinson was in the center of a cleared space by now, and she held her hands out desperately as the villagers moved in on her. “It isn’t fair,” she said. A stone hit her on the side of the head.
Old Man Warner was saying, “Come on, come on, everyone.” Steve Adams was in front of the crowd of villagers, with Mrs. Graves beside him.
“It isn’t fair, it isn’t right,” Mrs. Hutchinson screamed and they they were upon her.
The first two paragraphs of the story give this ending its power because they present an mundane town gathering with two slightly odd, but not too troubling exceptions: a lottery is being held and stones are being gathered. Readers discover the connection between the stones and the lottery as the story ends. So, one strategy for an effective ending is a return to earlier elements that shows a connection readers might not expect.
Ray Bradbury’s “August 2026: There Will Come Soft Rains” does something similar. It starts with a house making an announcement to occupants who are no longer there. The story follows the house through the process of its day and through a fire that destroys it. Here is the ending:
Smoke and silence. A great quantity of smoke.
Dawn showed faintly in the east. Among the ruins, one wall stood alone. Within the wall, a last voice said, over and over again and again, even as the sun rose to shine upon the heaped rubble and steam:
“Today is August 5, 2026, today is August 5, 2026, today is . . .”
This last sentence also returns to earlier story elements. It shows that a process begun in the first paragraph continues but under changed/broken conditions, rather than showing a connection as Jackson’s ending did.
If you are worried about writing an ending, consider drafting a return to something earlier, but with a difference. The difference might show a change like Bradbury’s or a connection like Jackson’s.