This is the first thing worth being clear about: astringency is felt, not tasted. Tannins bind salivary proteins and strip the mouth of its lubrication, and the resulting roughness is registered by touch. It is why tannin is described in terms of texture — fine, grainy, chalky, coarse — rather than in terms of flavour.
Where they come from
Chiefly the skins and seeds, and the stems where these are included in the ferment. Red wine is fermented in contact with its skins and white wine usually is not, which is the main reason reds are tannic and whites generally are not. Oak ageing contributes a further set of tannins from the wood.
Why they matter for keeping
Tannins polymerise slowly over years into larger molecules, which are perceived as softer and eventually fall out of solution as sediment. This is a large part of why a hard young red becomes approachable with age, and why an old bottle throws a deposit.
Why food changes them
Because they bind protein, they bind the protein in food as readily as the protein in saliva. A tannic red genuinely reads as softer alongside fat or protein — one of the few food-and-wine claims with a plain physical mechanism behind it.