This usually happens when the ball is very close (just a few inches) and the player is almost guaranteed (99+%) to make it. In non-professional play, players will sometimes just pick up the ball without tapping it in, but in professional play the ball must go into the cup, no matter how close it is.
As gbianchi says in the comments, the player who is farthest away is usually the next to go (Rule 10-1b), but he's not entirely correct in that someone closer is not allowed to go first. The relevant rules are 22-1 and 22-2.
Rule 22-1 and 22-2 allow for any player lifting any ball (lifting means you remove it but replace it in exactly the same spot after the other player shoots) if the ball may assist another player (Rule 22-1) or the shooting player having another ball lifted if it will interfere with his/her own shot (Rule 22-2). They both have the same clause in them:
"In stroke play, a player required to lift his ball may play first rather than lift the...