How to Repair a Remote Key
Although most remote key fobs have excellent battery life, they'll eventually get worn out. Sometimes it's as simple as changing the batteries, but occasionally there are more serious problems.
A quick fix that can aid is to disassemble the remote, cleaning the buttons and flexing them in and out. These steps could be all you need to get your key fob to work.
Battery
If the fob is still functioning it is possible to swap out the CR2025 or CR2032 battery. If it's not then you can remove the fob and examine the batteries' terminals and buttons for any signs of looseness or damaged parts. It is usually possible to solder the terminals and buttons back in place. However, key repairs will need to know what type of battery is installed in your fob.
If you're not sure whether the battery is the problem, use a backup fob to start or unlock your vehicle. If it's possible, it's time to replace the primary fob. If it doesn't require replacement, you'll require a professional assess the fob to identify the issue. It could be as simple as reset, or it could require other types of repair. It could also be that your car has lost the fob. This is not something you can tackle on your own.

Case Study
The case of remote keys is the plastic case that surrounds it and typically comes with the replacement button pad. It is recommended to purchase a brand new case, because the one you have is likely to be very dirty. Also, it is essential that the circuit board in the case is placed correctly. The circuit board is responsible for controlling the function of the key fob. You can test it using a multimeter set to RF (radiofrequency) mode, and a radio scanner that is tuned to the same frequency as the key fob.
Another thing to look at is the contact points for buttons on the keypad. These may have become loose or broken in the course of time. A careful soldering process to put them back in place will often restore them to full functionality unless they completely snap off.
Buttons
If your key fob buttons aren't working anymore or are difficult to push, you can buy a new dorman or motormite remote key housing online at a low cost for your model/year/make. Then pop the circuit board out of your old case into the new one. You may have to slightly adjust the position of the board on some models. The black contact points of the buttons can be bonded to with aluminum foil and double-sided tape.
Programming
The key fob and receiver in your car are paired however, this connection may be damaged. A professional will assess the vehicle to determine the make, year and model and make use of specialist equipment to repair or program the fob with a blank transponder chip (or make a key replica if this is possible). They will then test the remote to ensure that it works.
When reprogramming keys that are blank, it is important to take care. The process is complicated and each manufacturer offers different instructions. It is easy to miss a crucial step or wait too long before exiting the programming mode. To reduce the chance of damaging your vehicle it is recommended to employ an expert with extensive knowledge of the security system of your vehicle. Some key programming tools also have the capability of analyzing diagnostic trouble codes from your vehicle, which could aid in repairing or resolving other issues.