I'll not repeat what the other answers have already correctly stated but I will provide an answer relating to a subpart of your question:
Is it related to giving the player another cap? (perhaps pay related for an appearance?)
This can, indeed, be a factor. Although it's less likely that a manager brings on a player to earn his appearance fee, the number of caps a player has earned in a season can be important.
Sometimes a club may loan a player to another team but, as a requirement, they may stipulate that the loanee player must complete a certain number of minutes or games for the agreement to go through.
More often though, is that certain competitions will only give winners' medals to players who have made a certain number of caps in the said competition.
One example that springs to mind is when Martin Keown needed one more cap to qualify for a EPL medal with Arsenal. Ray Parlour jokingly pretended to get ready to come on as their last substitution to frighten him (Keown) into thinking he wasn't going to play and get his medal.
Another point not mentioned is that sometimes a manager will bring off a star performer in the final minutes/seconds of the game so that they get the ovation that they deserve.