I had an interesting discussion with a student recently regarding cancelling projects. In question was whether it is appropriate to cancel a failing project. The student's position was that a project should never be cancelled. The claim was that, at least at the large company where the student works, they could not afford to cancel a project once it started. If it is failing, then one would investigate the cause and make whatever changes are needed to get back on track.
Of course, you want to track things carefully to be sure any project is progressing as it should. If it gets into trouble, you do a risk assessment and change requests and whatever needs to be done to salvage it. But eventually, if it's actually failing, you cancel it. I think the disagreement came down to perhaps a difference in definition of "failing". If you have been through the process of analyzing what is going on and trying to fix it and it is still doomed for failure, then yes, it needs to be cancelled. If a couple things are just not going as planned, that doesn't mean failure; it means job security for good project managers.
There are many projects that are not cancelled even though they should be because of not much more than pride or attempting to save face. One of the most important concepts I learned about in my MBA program is that of sunk costs. That is, if you’ve already spent the money, it’s gone, sunk, finito. You don’t look back. What you already spent in the past is less important than what is going to happen moving forward. You look at how much it will cost to complete the project or change it or whatever moving forward, and the corresponding opportunity cost (which concept I learned about in undergrad economics), which is to look at whether there is something better you could be doing with that money (or time or any other resources involved) instead. This is sometimes referred to as a good-better-best comparison.
This not being willing to cut one's losses is where compulsive gamblers run into a similar issue, where they lose money and the more they lose the more they want to bet to try to win that money back. But it just digs the hole deeper instead of salvaging what remains in order to take the lessons learned and invest more wisely in the future.
Even better than straight up cancelling, however, is to build in several exit gates throughout the project so that upon completion of a phase, a planned review takes place, with the intent of determining whether the project should proceed. This is most common when the first phase is a feasibility study, but it can also be added after a prototype, pilot, or contract negotiation phase. Write up the criteria correctly, and you can find yourself successfully terminating a project by making the determination that a contract is not worth pursuing or that the pilot did not show the expected benefits. Then reallocate resources to something better.