If the key fob for your 2005 Mazda 6 ever loses it's synchronisation with the vehicle (this may happen after a battery replacement), you'll need to reprogram the fob to the vehicle. The key fob, also called a keyless remote, is part of the car's keyless entry system. The fob communicates with the car's computer using a wireless signal. You can reprogram a key fob on your own without visiting a Mazda dealer.
Open your driver's door and sit in the seat. Turn the Mazda 6 off and remove the key from the ignition column, if it is currently inserted. Leave the driver's door open.
Push the "Lock" switch on the interior door panel, and then push the "Unlock" switch.
Place the key in the ignition column. Turn the key to "On" then "Off" three times within a 10 second time frame. Leave the key inserted in the ignition.
Close the door, and then open it. Close it and open it twice more (total of three times). Stop with the door open. At this point, the Mazda's doors will lock, and then unlock.
Push the "Lock" or "Unlock" button on the remote twice quickly. The Mazda's doors will lock, and then unlock again. This tells you the remote is reprogrammed.
According to the Mazda 6 owner's manual, the remote will not program to the vehicle if the battery is dead. Pry the remote open with a coin if you need to replace the battery. Only use battery number CR2025.