What can cause the capacitor in an air conditioner to fail?
The life of electrolytic capacitors is primarily shortened by heat. Therefore ambient temperature, temperature of nearby motors, ventilation and air circulation (e.g. fan), presence of thick layers of dust, clogged grilles, excess paint, ... can be important factors. 

Electrolytic capacitors are manufactured to various specifications:


Capacitance: e.g. 1 uF,  10000 uF
Voltage (maximum) e.g. 5V, 400 V
Lifetime e.g. 1000 hours at 80 C, 1250 hours at 150C
Operating Temperature e.g. 40-85, 25-150 C


By choosing a capacitor that suits your operating conditions you can ensure that you get the maximum life.    

As with many things, some manufacturers produce good quality products and some low-cost manufacturers simply lie about their products' specifications. Choosing the right manufacturer may have a large influence on operational lifetime.