There are sooooooooo many factors, it's impossible to answer it properly.
Read Death March, it's a book on the subject.
However, I've observed two causes that tend to appear in most failures (they are both linked):
Internal company politics
The large the company is, the most affected you will be. Most people working in large enterprise are encouraged to move up the career ladder. Project success may not be the way to do that. In fact, if there is two project managers that are likely to take a higher rank, one will be tempted to make everything necessary to make the project of the other fail. In smaller enterprise, you have shareholders conflicts. You take decisions based on personnal interests instead of project interest. And so on.. this is infinite!
Since developers don't like the idea to become managers, most of the people that drive a project simply doesn't understand developing a software is different. On the other hand, some developers with poor social skills want to be a manager and fail too. Become managing people is not writing code...
They try to manage it like what they did in their previous experience (not software related or how they usually write code for the others) and then fail... Most of them don't learn from their mistake, so they try offshore instead, but that's worse! Then they usually repeat once before giving up to another fresh manager that think he will succeed... applying the same management methods ;)
I've found some solution in those problems in Agile. But nothing can replace an highly skilled team. With the dream team, you can most of the time go trought most of the problems explained above. A lot of chance can be also involved...