The going up to cash your winners is a good reason.
Another common reason to play second hand high is to deny an entry.
Here is an example.
South below is in 3NT, you are West and you lead a heart.
AJT9x
xxx
xxx
xx
Kxx Qxx
QJTx xx
xx QJTx
Jxxx xxxx
xx
AKxx
AKxx
AKQ
During the bidding East/West know that South has no more than two spades (say the bidding goes 2C-2S-2NT-3NT starting with 2C by South, and East/West remaining silent).
South has 8 top tricks and needs one more.
South wins your heart Q with the K and leads a spade. At this point, you must play the K!
If you play low, declarer will play the 9. If East wins, declarer will make many overtricks (by repeating the diamond finesse). So East will have to duck this, but declarer will make his contract.
If you play the K, declarer can setup dummy's diamonds, but will not have an entry to cash them, and will only be able to make 8 tricks.
Another reason to play second hand high is to prevent declarer from ducking a trick to a safe hand.
As an example:
xxx
xxx
Kxx
xxxx
AQxxx Tx
Qx JTx
xxx QJTx
Jxx xxxx
KJx
AK9xx
Axx
AK
South is in 3NT and you are East.
Partner leads a low spade, and declarer wins your T with the J. (If he ducks this, he is down immediately).
Now declarer plays a diamond to dummy's K and plays a heart. At this point, you must play the heart J or T. If you play low, declarer will stick in the 9, losing the trick to the safe hand, which cannot continue spades without losing a trick and a tempo.
If declarer ducks your heart J, then you can push a spade through and beat the contract. So declarer will have to play the A or K, and partner will have to continue the good defence by dropping the heart Q! (else declarer can next play a low heart).
Since declarer has no more entries to the dummy, your Tx is safe from being finessed with the K9, and declarer will go down ultimately.