Raising simply to gain information is a tricky play and shouldn’t
be done often. Generally you should consider any information
gained as an extra benefit of a raise you are making for other
reasons.
Let's say with a pair of kings on fourth street in seven-card
stud you raise an open pair of 9s. Your opponent reraises.
You decide that opponent has three 9s and fold. By risking
one bet (your raise), you save as many as three bets you might
otherwise have called on fifth street, sixth street, and on
the end. Your savings is even greater when the bet doubles
after fourth street. A trial-balloon raise on a $10 round
could save you three $20 calls later.
Nevertheless, raising just to gain information is tricky.
For example, if that open pair of 9s just calls your raise,
can you be sure that opponent doesn't have three 9s? What
to do on the next round may still not be clear to you. That
is why you should generally reserve your raises for other
purposes and consider whatever information you gain from your
opponents' responses as an added benefit.