As Andyreas said it's not an exact science. If you are playing online then use a tracker and it will make your life a lot easier (Holdem Manager or Poker Tracker for example). Color code the players by the number of
hands they play or track how often they play positionally.
In online cash games I periodically go through regulars on the levels I play and review their stats and make notes for myself in the client on tendencies I've noticed which helps a lot. That's less useful if you are playing online tournaments and useless of course if you are playing live.
Live the easiest thing to pay attention to is just how many hands a person plays. And how positionally aware they are. Bad players will often play the same hands from any position and you need to widen their range in that case. While they will make mistakes more often, it's tough to narrow them down to a range if they are playing a lot of hands from all positions. Especially if they are limping and it's being allowed to go through. In that case I'd just widen my own range and try to keep the pots small unless I hit a premium flop then go for maximum value because those players will often call down with losing hands.
As you go up to higher levels most players tend to be easier to put on an opening range. The button and cut off are generally pretty wide and early position is generally pretty strong. Though it does seem more common these days to see early position play with suited connectors if the there isn't a lot of raising, but for the most part if I see an early position raise in a higher stakes game I'm assuming they have either a pair or KQ minimum unless they are playing a ton of hands. In that case if the flop comes all small cards and I'm in position I'll usually take a stab at the pot, and if reraised I generally would assume they have a pocket pair and just let it go.