Creating a successful compost pile is more complicated than simply throwing your lawn clippings and tree trimmings in a heap on the ground. Compost piles are successful when the microorganisms that cause decay in organic matter have the optimum environment to flourish and do what they do best: break that matter down into its richest and most basic components. So how do you maintain this environment?
Microorganisms need several things to flourish. The first of these is a food source. Grass clippings, banana, apple, and orange peels, chopped-up branches and stalks, dead leaves, weeds, and plant matter are all good sources. Fatty scraps and bones are good, too, but if you are going to use these in a compost pile they must be buried at least eight inches deep, or else they can attract pests. Also, make sure you have a great variety of material in your pile, as too much of the same thing can discourage microorganisms and encourage putrefaction.
The next thing microorganisms need is warmth. Insulate your pile with a layer of dirt and leaves in cool weather, and a mattress or old carpet in cold weather.
Microorganisms need moisture, so dampen any dry material you add and water your pile in the summer.
Finally, microorganisms need aeration. In a compost pile, you want an aerobic breakdown, which churns organic matter into soil. If you don't air your compost pile properly, you get anaerobic breakdown, or putrefaction, which basically turns things to goo. Turn your compost pile regularly, never let it get more than five feet high, and make sure there are enough gaps in the top to get air down into the center.
If you follow these guidelines, your hard work and care will certainly pay dividends in the health and vitality of your yard or garden.