I bought a bottle of wine larger than required for my recipe. How and how long can I keep the remainder, so I can use it in cooking again? (In other words, it needn't be drinkable.)
Tightly closed and in the fridge it will keep for a few days, maybe a week if you can tolerate it being a bit rough (which you can for some dishes like my tomato, smoked garlic and red wine sauce with chilli - in fact that doesn't want anything too delicate to start with). If there's less than about 2/3 of the bottle left, transfer to a smaller container.
But that's not what I would do. Instead I'd freeze it in useful quantities. There are two things to bear in mind of you freeze wine: it expands (so use a bigger container than you think); and it doesn't go completely solid (so keep it the right way up). In the freezer it keeps indefinitely.
You don't want it to go far beyond drinkable, unless your recipe calls for vinegar as well, which you should use less of.
Wine has to be drinkable to be used in cooking, if it goes nasty you'll be adding the nasty flavors to your food! Don't cook with wine you wouldn't be happy to serve at your table. Wine keeps for a long time in the refrigerator, so cap it back up as tight as you can and get it in there as soon as you can after using it.
I recommend a Wine Pump Preserver, it's cheap and has open wine bottles last much longer.
Doing this and keeping the wine refrigerated should help the wine last longer otherwise taste and or smell for a sour or vinegar taste before use. Wine should be drinkable if used to cook with (exception being cooking wine for the drinkability but that also can still go bad).