Believe it or not, the announcers depict when to end the match. It's something like they lift their pen up when the match needs to be rapped up in five minutes and lift their finger up for ten. I dunno if that's correct, but they give the ref signals as to when to end the match and then the ref tells the wrestlers... so it is very scripted in my opinion.
That is NOT true in the SLIGHTEST! Whoever told you that/wherever you read that is probably pretending to know more than they actually do.
The referees will tell the superstars when to wrap it up, and i'm SURE you've seen that they have an earpiece. Someone sits in the "gorilla position", a seat just behind the curtain, usually Vince, and he tells the referees when the time allotted for the match is running out. The referee will then tell the superstars to "go home", or wrap up their match.
The announcers know NOTHING. JR and Cole weren't even aware that they were being drafted to SmackDown and RAW respectively, as an example.
As far as the actual matches go, wrestlers used to improvise their moves in the ring, with one or two "spots" and in a big match, a "high spot", which are a series of moves that are planned to go one after the other. A finish is also decided before the match so the wrestlers have somewhere to work towards. More recently, the wrestlers work out the match almost move by move with agents in the back - just a sign of changing times in the business.
It's obvious that the stories they are telling are scripted, and while moves are planned occasionally (more often now than not), they are still incredibly dangerous and can go horribly wrong. Case in point - Lesnar at WrestleMania XIX did a shooting star press and could not get full rotation, thus crashed to the mat headfirst - concussion and severe neck injury - wasn't REALLY the same again.
and THAT is why it's incredibly insulting to wrestlers to hear people that aren't fans of wrestling describe what they do as "fake".