Well, obviously like everything in poker, the answer is: "it depends".
Let's strip it down to its core: Pocket pairs are good because if you go against an opponent that doesn't have a pocket pair, he needs to hit the flop/turn/river somehow in order to have showdown value. You don't have to connect to the flop to do this, because you already have a pair.
This is actually the reason why pocket Aces are the best hand. In this case, your opponent has to connect to the board. But because there is no higher pair than Aces, he has to do it twice in order to win (with some exceptions obviously). This is unlikely to happen, especially in Texas Hold'em.
Small pocket pairs lose their value as their rank goes down. Let's take for example pocket sixes. Cards bigger than sixes are 7 and up, this means (14 - 7 + 1) x 4 = 32. There is a huge chance that one of those 32 cards will show up on the board. Now if we consider pocket threes, then there are 44 cards bigger than a 3.
What this means is that, unless you hit a set, the value of your hand will be low, especially if a multi-player hand.
In my opinion a good way to play these hands is to make a standard preflop raise and hope to hit a set on the flop. If you can see a free turn or river, go with it. But if at any time you start to encouter resistance (a.k.a. your opponent(s) bet or raise), GIVE IT UP. The odds of hitting a set are so low, that calling any bet would not make sense.
I usually never play 22-55 unless I'm deep enough (at least 40 BB). When it comes to 66-88, the value increases a bit so you can play the hand a little more often.
When it comes to pocket nines or above, things change significantly.
All this is obviously just a small part of the decision process. There are a lot more factors to consider. There are situations where it's a good idea to play pocket fours and other situations where folding Jacks makes a lot of sense... It depends on the action, how your opponent(s) play, is it tournament or cash, how deep everyone is and much more.