My storytelling experience so far has been in tabletop rpgs, but a lot of that can also be applied to the stories told in video games. I will cover two example, one good and one bad from my own experiences and what I did to enhance or recover the story.
I will start with the bad. My group fought their way through a tunnel to reach the hidden keep of a mad wizard, and in the process aquired a couple of floating rods. The reason I included the rods was because I planned for them to use the rods to stop a pendulum to open a secret door. What they really used them for was to climb to the top of the tower...
So there I was, with a dumbstruck look on my face trying to figure out what to do because everything was laid out in a bottom to top fashion and they just bypassed the buildup and practically jumped on the poor fools head. Once the put the wizard out of his misery and stopped the pendulum with the rods, they heard the click of a lockdrop from downstairs. This is where I improvised.
I buffed up his familliar and had him sneak around being creepy, making lots of footprints in the dust and making noises. To pay back for my poor wizard, I dropped the familiar down on the lead character's head and enjoyed the resulting chaos. After that things went as planned.
The lessons I learned from this were if there's a way there's a will, and stories aren't always as linear as you plan because of player choice. What I should have done is have the rods inactive and placed the means of activation somewhere in the tower, which would have further engaged the players in the story...but at least they got some good laughs in at my expense.
Now for the good. As a random encounter while the group was prowling a city in a post-apocalyptic setting, they were mugged by a group of thugs that were members of the citiy's mafia. The leader of the muggers had a brother who sought revenge. After this second fight in a back alley, a player made a bad roll and accidentally knocked over a fire barrel and set the bodies on fire.
I decided that this impressed the mob boss and sent the players an invitation for a meeting and a partnership occurred, which opened many more adventure possibilities. This went a lot better than the first example and really expanded the feel and content of the story for the players.
When writing your story, give your players choices with consequence, good or bad. Also, the effects of their choices don't have to happen as soon as the choice is made. Hopefully these two examples have entertained and inspired.