Few techniques in fiction are more dangerous than a twist ending.
All too often, writers lean on the twist to make a story interesting, but in doing this, can shift essential focus away from those other, more important elements of the story.
Writers might also hope to surprise readers, but readers are almost impossible to catch off-guard; instead, they predict the writer's ending long before the writer can spring any surprise. A writer out-guessed can seem unimaginative at best, foolish at worst.
On the other hand, a twist can be useful, not at the end of a story, but right at the centre. Putting a twist at the heart of a story allows a writer to maintain interest, while offering enough time to explore the implications of the twist: implications that transform the twist from a mere gimmick into a major component of plot, character, theme.
Another method is rare, but effective. William Sansom provides my favourite example in "A Wedding," but Eric Frank Russell takes the same approach in "The Rhythm of the Rats." They present a story in retrospect, long after events have taken place, and then, in the final sentence, provide one piece of information that shifts the entire story into a new perspective. This information is a minor fact not revealed in the course of the story, because the narrator was too engrossed in telling the tale to consider this one small detail important. The narrator takes it for granted, but for the reader, it becomes not a twist, but a bluntly dramatic explanation, an insight into context, a lens that puts everything else into focus. Instead of changing the story, it justifies the story.
Illustration by Matt Fox. Weird Tales, July 1950.