To replace the battery, you will need to remove the metal cover of your key fob. There may be a small screw that holds the cover in place, or it may simply snap off. Once the cover is removed, you will see the battery. It is a small, round battery, usually a CR2032 or CR2025. You can purchase a replacement battery at most hardware or electronics stores.
To replace the battery, simply remove the old battery and insert the new one. Make sure that the positive (+) side of the battery is facing up. Then, snap the cover back on.
Note: If you do not have a spare battery on hand, you can continue to use the key by inserting it directly into the ignition barrel and turning it. You will not be able to use the remote locking and unlocking functions until you replace the battery, however.
It is also worth noting that the "flip battery spent" message may also appear if the battery in the car is low on power, so you should check that as well.