Against good players, if they hang around long enough in the hand (i.e. betting/calling/raising) their range is usually defined to one of a few hands, this shouldn't be difficult. Particularly when you're representing a big pocket pair and they're good enough to know that, be concerned if they're willing to put a lot of chips in.
Against fish, they tend to do stupid things to give away the strength of their hand. They'll check raise, they'll slow play and throw out odd looking bets (these can actually be dangerous, as they can look like bad bluffs so use your history with them and the size of the
odds they're laying you to make your decision). Nits also will finally have a hand they're prepared to put a lot of chips in, if you get raised by a nit and don't think he can beat your TPTK or overpair, there's something wrong.
Of course, if you have a good hand yourself but don't have position then you're often going to lose a big chunk of your stack to weak players because them calling you on the flop/turn is expected with a wide range, and it's only their river raise that will give away their hand and often you'll be priced into the call.
If they turn/river their set then you're going to have to pay them off, more often than not if you get away from it then it's going to be because you put them on the wrong hand, but one that could also beat you.