Example 1:
A late position player comes in for a raise. The dealer calls. Small blind folds, you are in the big blind and call with the 52. The flop comes Q52. You check, the late player bets. The dealer raises. What do you do?
What hands are they likely to have? Well, they probably have pretty decent starts hands considering the starting action. The initial better on the flop may well have something like AK or AJ that aren't a great hand on the flop, they may just be continuing aggression. They could also have any pocket pair, but probably not AA, KK, or QQ, so they could have JJ or lower. They might also have something like AQ,KQ,QJ. It's less likely that they have a monster like QQ, 55 or 22. We rule out all the two-pairs, since they wouldn't play Q5, Q2 or 52. The raiser (the dealer) probably has a better hand, something at least as good as top-pair top-kicker, so they have AQ or QQ or 55 or 22. There's also some small chance that they have something like a flush-draw and they're playing the raise-bluff.
So, should you call? You basically just have to look at the hands that the raiser could have. You beat AQ, but lose to QQ and 55 and 22. So you beat 12 hands, and lose to 3+1+1=5 hands, so you have a 12/17 chance of being ahead. So, you should call (there's also some chance they're on a semi-bluff which makes a call even better). What about a raise? If a flush draw is possible you need to raise so they can't see it for free. If a flush is not possible, you might just call. The reason is that hands you beat will probably fold. Calling hands may well beat you (unless they are bad players). The reason a call is good is that the initial bettor may also call with a bad hand, drawing to very few outs (eg. if they have KQ). Also, if the initial bettor had a very good hand (very unlikely) they might re-raise, in which case you can fold (depending on the size of the bet).
Just for laughs, what if you do just call, and the initial bettor does raise. The dealer now folds, and it's up to you. You put him on QQ or 55 or 22, one of the sets. You are now on a draw, you need a 5 or a 2 to make a full house. The problem is you are usually drawing dead. If he has QQ, then any 5 or 2 that comes makes him a better house. If he has a 55, then a 5 cannot come, and a 2 makes him a better house. If he has a 22, then a 2 cannot come, a 5 can make you the winning hand. So you only win if he has the 22 and a 5 comes, so your chance is (1/5)*(2/45) = 0.0089 , about 1%. So, you must fold. The only hands you beat are bluffs, and it's pretty unlikely he's bluffing in this situation since there are two players behind him who have both shown quite a bit of strength.
Example 2:
JTs comes in for a raise.
KJ calls the raise.
Flop is AQ5.
KJ checks it.
JTs bets it.
KJ must fold.
This is part of the reason why you must not play KJ, and you must not play softly, just calling.
Note:
Sometimes you just have to lose your money. If you have KK and another player has AA, you may well have to get all-in against them. Ideally you have more chips than them so that if this kind of bad situation does happen, it won't knock you out.