Throughout the summer months, or any time the air conditioner is on, the unit should not be covered. In order to function, air conditioners have to be able to exchange heat through their coils. A covered air conditioner, even one loosely covered, will be substantially less energy efficient and can very quickly overheat and burn out. Providing shade for your unit is fine, so long as the tree or awning providing shade in no way obstructs air flow around the unit.
In winter, window air conditioners should be removed wherever possible. First, these units are effectively open windows when installed. Cold air can freely move through the unit and into your house, forcing your heating system to work harder to maintain a warm temperature. Secondly, a unit's lifespan can be substantially increased by not exposing it to snow and ice. Store your unit in the attic or basement, up on blocks and away from the elements.
Some window air conditioners are too large, or too well secured to be removed every winter. These units should be covered from the outside using an air conditioner cover that is properly sized. You can also duct tape the openings around the window to further seal up the unit. In a pinch, a large tarp and bungee cords can act as a temporary cover to prevent exposing the unit to snow and ice.
Central air conditioning units are expensive pieces of equipment. Covering them for the winter is a great way to protect your investment. You should also consider applying a light coat of car wax to the outside of the metal case, to prevent rusting. After waxing, cover the unit with a cover sized properly for your conditioner, and secure the cover using bungee cords.