It’s really just observation and practice. You have to understand what gives the illusion of texture–the irregularities in surface, the patterns they form, the way they catch light…etc. Traditional painters use splatters, sponges, salt, sand, scumbling…etc to create textures in their paintings, but digitally, you’d have to rely on what the digital brushes are capable of producing. Using the more organic brushes is a good way to start–ones with irregularities. Layer different values with different organic brushes–for example, have really dark brushstrokes underneath, then apply a lighter value on top–this will give the illusion that the surface of that texture catches light and has depth. The, you can selectively add an even bright highlight to some spots with a really small brush, to create even more depth.
It’s also important to know that a lot of what appears to be very detailed, when looked at up close, is actually pretty messy and impressionistic. The most important thing is to understand how light interacts with textured surfaces–then you can mimic that look with as little or as much detail as you want. Go look at some of Craig Mullin’s work (www.goodbrush.com) for what great impressionistic digital painting can look like. He does both highly detailed work and also impressionistic illustrations. Look at the impressionistic stuff as they are much more telling of what’s important in depicting textures.