Short answer: Don’t.
It can be tempting to only swap out only the battery that’s died, but you shouldn’t. It’s like trying to write an essay with your non-dominant hand: You might technically be able to do it, but you’re not going to like the end result.
So, replace all of the batteries at the same time. Using only fresh batteries together will maintain their lifespan and is much safer.
For example, your TV remote uses two AA batteries and is dying. You only have one fresh battery on hand. If you only replace one of the batteries, the good battery will not last. The new battery will have to work extra hard to meet the power demands of the remote, which will shorten it’s lifespan significantly.
Also, that dead battery still in the remote? It runs the risk of overheating as the fresh battery works. The reason for this is the fresh battery is delivering large current into a dead battery that has high resistance. This causes excessive heat to build up. This is explained by Joule’s law, the relationship between electrical power and thermal (heat) energy.
Two fresh batteries avoid this as they increase in resistance together as they deplete, limiting the current the batteries are supplying. Most batteries are designed to be safe under these conditions.
So, just replace both of them and save yourself some grief!
We recommend using batteries from the same brand, too, since there can be small differences in the voltage and capacity of the battery. AA alkaline batteries are rated at 1.5 volt, but this number is an estimate. Some manufacturers could round up from a number like 14.9 volt, and then another could round down from 15.2 volt. It’s a small difference, but this electrical imbalance could negatively affect performance.