Apple Wireless Keyboard: Cleaning the battery contacts
The Apple Wireless Keyboard is powered by batteries that you install in the compartment on the underside of the keyboard. To clean the battery contacts in the battery compartment, remove the batteries and rub a clean pencil eraser over the two flat (positive) contact surfaces.
Cleaning the (negative) spring contacts is not necessary.
After cleaning the contacts, turn the keyboard over and remove any residue that the eraser may have left in the battery tray. Reinsert the batteries (or install fresh ones) replace the battery tray cover, and slide the keyboard power switch to On. The green power LED should light up, then flash, as it pairs with the computer. The LED will go off after the keyboard is paired up.
The battery contacts can develop a coating that could prevent enough power from getting to the keyboard. This could prevent the keyboard's Bluetooth transmitter from pairing with the computer your attempting to use it with.