First of all, if you play online get one of the
Apps like Holdem Manager or Poker Tracker 4. These cost money generally but are very informative. They give you a lot of details about your opponents playing style which helps you understand what he might be holding.
When first starting it's easiest to just try and figure out what group of
hands your opponents hand range is.
Group 1 is your premium hands like AA, KK, AKs,
Group 2 is your hands like AKo AQs KQs, QQ, JJ,
Group 3- KQo AJs A10s 99, 1010, QJs
Group 4- K10s A9s K9sm QJ, Q10s J10s, 77, 88
Group 5- Axs J10, J9s
Etc Etc.
So you get to know your player and you keep an eye on his play from each position and how he plays hands. Then when you get tangled into a hand with him you try to place him on one of those hands groups. Lets use an example of a tight player. You can generally assume a player that bets/reraises from early position generally is only playing a hand in top part of his range since he is out of position on each betting round. You can also assume that players in position will play a little bit looser.
So you take into account his raises, checks or bets and compare that to which cards fall on the Flop, Turn and River and try to deduce what he might have in each situation.
For example, I know in my Monday and Friday cash games, a player I play with frequently will also raised to between 24-30 with AA,KK, QQ and AK. So I know that when he makes that bet he is playing the top part of his range and unless I can beat that or have a good drawing hand I need to be careful and get out. This isn't as easy to do with online players since you play so many hands and don't play with same opponents as long but thats where your Poker Tracker or hold em manager
App comes in handy.
While you start just try to put opponents into hand groupings similar to what I have done. Get some experience doing that. Read up on Sklansky's view on hand ranges and reading hands. I also really like "Let There Be Range" by Cole South and a gentlemen whose name escapes me at the moment but that book has some good teachings about reading hands.
As you become more experienced it will be easier to nail down your opponents on hands. Your not gonna be right all of the time, but a better understanding of what your opponents might be holding helps you play your hand that much better.