When your card charges you a fee: The only reason I would condone canceling a card is if it charges an annual fee and you do not earn rewards to offset it. But before you cancel, call the issuer. In many cases, they'll waive the annual fee for a year or offer a reward bonus! You know when you call your cable provider and speak to 3 people before they connect you with the "retention specialist"? This is the same thing.
If you do decide to cancel: Make sure you redeem all of your outstanding rewards! You may forfeit these points and miles as soon as you cancel the card. Additionally, if you use this card to pay any bills automatically, make sure you transfer those payments. Trust me, this will save you a big headache down the road.
If you decide to keep an old card open: An issuer may close your account after a period of time with no activity. If you have an old card in your wallet that you want to keep, make sure you use it periodically to keep it active.