My dd2 had a couple of night terrors, when she was a toddler. She would be asleep but screaming, flinging herself around the bedroom just like a bad tantrum. She didn't remember anything in the morning unlike nightmares where I think you remember them. After googling it, I put it down to night terrors, it said they could be caused by being overtired rather than anything more worrying, she had just started pre-school. Like Sirzy said, we held her firmly, spoke softly to her and she would stop.
I'm not sure if you can prevent them. I spoke to DS pediatrican about this last week when he was there and he said the best way to deal with it is to calm them down without waking them so lie back down and stroke them, or cuddle them and then put them back down.
My dd went through this a few months back she would scream and cry for no reason in the night. I ended up gettig her a night light but wouldnt allow her to fall asleep with it on. It was there to be switch on throughout the night of she felt scared. She now falls asleep with it off shouts me if she's scared and Wants it on, and often asks me to turn it off too! it's helped a lot