A plot twist is simply when the audience logically expects something to happen, only for their expectations to be subverted and for the story to go in a different direction. There is no single rule for how to write a plot twist (not to mention do it well), but this blog post and the next will outline a few guidelines on how to write a shocking plot twist.
