When working with an element unfamiliar to your reader, such as a certain magical spell or fantastical beast, it is important to introduce how that element works before using it in an important situation, especially a situation that involves a twist or mystery. You have to play fair with your reader by exposing the magic before the magical result is important to the story.
JKR was really good about this. For example, we saw McGonagall transforming as an animagus long before the Padfoot, Wormtail, Prongs, and Mooney thread of Prisoner of Azkaban. Likewise, JKR introduced the Polyjuice potion as a relatively minor plot point in Chamber of Secrets before it became a major potion of concealment two books later.
In looking at Goblet of Fire, I found two magical elements that JKR deliberately introduced to her reader at the beginning of the story which played a crucial role in its climax: the Portkey and Prior Incantato. Portkeys, according to Mr. Weasley are "objects that are used to transport wizards from one spot to another at a prearranged time. You can do large groups at a time if you need to." And when Harry asks what type of objects they are, he replies, "Well, they can be anything...Unobtrusive things, obviously, so Muggles don't go picking them up and playing with them." (p. 70, GoF).
Portkeys can be anything...like a TriWizard Tournament Cup! And just like at the beginning of the book, Cedric takes hold of the Portkey along with Harry to a meeting that involves Death Eaters. Here at the dark moment, however, the Portkey transports Harry and Cedric into a much more deadly encounter where Cedric loses his life and Prior Incantato unleashes "the ghost of a spell" (p. 136) that reveals Harry's deceased mother and father.
When working with elements, magical or otherwise, that play a crucial role in the climax or mystery of your story, make sure you have introduced your reader to them, and the way they should work, beforehand. Give your reader a taste of magic early on so they have a fighting chance at playing along with your world and guessing your secrets. Foreshadow major elements that are yet to come. Introduce creations of your own imagination in such a way that your reader can be an active participant in your story. Don't just spring a crucial surprise on them that they could not have guessed. They'll feel cheated.
What magical or fantastical elements have you introduced into your story and how have you foreshadowed them?