As I mentioned in the article on tannins in the mash, most of the tannins in your beer come from malt and are extracted during the mash. The major procedural thing you can do to avoid extracting excessive amounts of tannins is not to oversparge — do not continue collecting wort when the pH rises above 5.8. (This assumes your mash is at 170 °F (77 °C) at the end of wort collection.) If you don’t have a pH meter, the cutoff point for wort collection usually coincides with the specific gravity of the final runnings dropping to 2–3 °Plato (SG 1.008–1.012). You can also cool down a sample of your final runnings and taste them. You will feel the astringency increasing near the end of wort collection. (Astringency is a mouthfeel, not a taste.)
Hops also contribute tannins to your beer. However, if your sweet wort — the wort you collected from your lauter tun, not yet hopped — is OK, you really don’t have to worry further much about tannins. And this is good, since your only real way of controlling hop-derived tannins is to change the amount of hops you use.
Before we go on, recall that tannins are water soluble. Anytime tannic plant material is in an aqueous environment, tannins are dissolving into the liquid. Heat, pH and time are the major variables in tannin extraction. In the mash, the combination of temperatures 170 °F (77 °C) and over, coupled with a pH of 5.8 or greater, leads to tannins being very soluble. However, those conditions are not an “off and on” switch. In a mash at 160 °F (71 °C) at a pH of 5.6, tannins would dissolving into the wort, only at a much lower rate. Finally, recall that tannins are always present in beer — they are only a problem if their concentration is high enough to cause astringency.