The major cause of terminal corrosion is moisture. Even a small amount of water getting into small gaps or spaces where the metal surfaces touch can lead to electrolysis, which will erode the metal. This in turn creates larger gaps, which allow more moisture to accumulate, causing the problem to grow worse over time.
A common method for preventing this is to coat the terminals with grease. This accomplishes two things: First, it seals off the metal surface from the air, which prevents oxidation. Second, it fills small gaps where moisture could accumulate in the future, preventing the opportunity for future electrolytic corrosion.
The grease must be resistant to heat, so it doesn't melt and flow away from the connection. Wheel bearing grease works nicely, or you can get dielectric grease or special products made for battery terminals.
It's possible to grease the terminals before connecting them. By using a tool such as the one in tlhlngan's answer, you roughen the surface of the terminals, exposing fresh, unoxidized metal surfaces. The grease prevents oxidation by the air, and if you tighten the terminals appropriately, the metal surfaces will crush together giving good metal-to-metal contact. Any small gaps remaining are filled with grease, not air or water.
Another factor is dissimilar metals contacting each other, which can cause galvanic corrosion even without the presence of an outside electrical charge. Having electricity flowing through the connection exacerbates this.
Posts and terminals themselves are typically made of lead alloys, so are not that dissimilar, but the cables are usually copper, and copper-lead connections will produce galvanic corrosion. Aftermarket terminals that are added to an existing cable to save time and money are particularly likely to do this.
The most important thing you can do to prevent corrosion is keep the area dry. Be careful when adding liquids to your radiator, washer fluid, or the battery itself. Some terminals come with little rubber or plastic covers, these help protect from splashing. A battery located near the front of the car may get more rain exposure than one farther back. Avoid driving through deep puddles.
If you do need to clean and wash the battery and terminals, allow them to dry thoroughly before reconnecting.