One of the most basic principles in D&D 3rd Edition is that most bonuses of any sort have a named descriptor. In general, only bonuses of different types stack (that is, add together for a cumulative effect). There are a few specific exceptions where bonuses of the same type also stack together, namely: "dodge" bonuses, "circumstance" bonuses, "synergy" bonuses, "enhancement" bonuses to weapons and their ammunition, and most significantly, the "armor" bonuses from a shield and a suit of armor.

Probably everyone should read PH p. 152 (under "Bonus Types"), PH p. 282 (see the glossary entry for "stack"), and DMG p. 176-177 (under "Bonuses From Magic") in order to acquaint themselves with this general rule. You can also find the same rule in the online System Reference Document published by the Open Gaming Foundation, under the heading "Bonuses From Magic Items", here: http://www.opengamingfoundation.org/srd/srdmagicitems.html.

Example 1: A character wears normal chainmail and a large shield. Both the chainmail and shield provide an "armor" bonus; since a suit of armor and a shield are one of the specific exceptions under which same-type bonuses are allowed to stack, the effect of the chainmail (+5) combines with that of the large shield (+2). Final AC: 10 + 5 + 2 = 17. (See also PH p. 104, under the heading "Armor Bonus", for the official statement.)

Example 2: A character wears normal chainmail and receives a mage armor spell. Chainmail provides an "armor" bonus (+5), and mage armor also provides an "armor" bonus (+4; see the spell description on PH p. 223). Since they are they same type, they fail to stack, and only the better chainmail protection is allowed. Final AC: 10 + 5 = 15. (See also PH p. 104, under "Armor Bonus", where it specifically notes that mage armor does not combine with normal equipment protection.)

Example 3: A character carries just a large shield and receives a mage armor spell. The shield provides an "armor" bonus (+2), and so does the spell (+4), so they do not stack. Only the higher bonus is applied (namely, the +4 from the spell). Final AC: 10 + 4 = 14. (Again, see PH p. 104, under "Armor Bonus", where this is explicitly noted. Furthermore, this was confirmed by the "Sage Advice" article in Dragon issue #284 and the Official D&D FAQ, page 20, available here: http://www.wizards.com/dnd/article.asp?x=dnd/er/er20011014a)

Example 4: A wizard casts the mage armor and shield spells on himself. While mage armor provides an "armor" bonus (+4), the shield spell lends a different type of protection, a "cover" bonus (+7). Therefore, the two bonuses stack together. Final AC: 10 + 4 + 7 = 21. (The shield spell's bonus was clarified in the Dragon magazine, issue #282 and the Official D&D FAQ, page 37. You may wish to see the spell description on PH p. 251, and also the official FAQ, at the preceding link.)

Example 5: A character wears normal chainmail, a large shield, and casts a shield spell. The chainmail and shield "armor" bonuses (+5 and +2) combine as usual, while the shield spell provides its different "cover" bonus (+7; as per the clarification noted above). Therefore, all three bonuses stack together. Final AC: 10 + 5 + 2 + 7 = 24.

Example 6: A character wears padded armor, casts a shield spell, and receives a barkskin spell. Padded armor provides an "armor" bonus (+1; again, from PH p. 104). The shield spell provides a "cover" bonus (+7). The barkskin spell provides yet another type of bonus, "natural armor" (+3; see the spell description on PH p. 177). Therefore, they all stack together. Final AC: 10 + 1 + 7 + 3 = 21.

Now, when discussing magic armor, it's important to note that magic suits of armor and shields carry an "enhancement" bonus which improves the protection afforded by the equipment. This means that magic armor and shield "enhancement" bonuses make the "armor" bonus higher. Enhancement bonuses are not themselves bonuses to the AC of a character. (See the exact definition of "enhancement bonus" on PH p. 278, on DMG p. 177, and also in the chart on DMG p. 177 where it notes that a bonus of this type "Improves: Armor's bonus".)

Example 7: A character wears +2 padded armor and receives a mage armor spell. Padded armor normally provides an "armor" bonus (+1), and magical armor includes an "enhancement" bonus of the listed value (+2). Therefore, +2 padded armor provides an improved "armor" bonus (of +3 total). Since mage armor also provides an "armor" bonus (+4), these two protections do not stack together; only the stronger mage armor spell is allowed to take effect. Final AC: 10 + 4 = 14.

Example 8: A cleric casts magic vestment on the +2 half-plate he is wearing. The magic vestment spell gives an "enhancement" bonus to any armor (+1; see the description on PH p. 225). However, the magic half-plate already has an "enhancement" bonus (+2), so the two effects fail to stack. Only the higher one applies (for a total "armor" bonus of 7 + 2 = +9). Final AC: 10 + 9 = 19. (Note that if the cleric had a normal shield, it would in fact help to cast the spell on that, since it would serve to separately raise the shield's armor bonus.)

Example 9: A fighter/wizard wears +2 chainmail, a +1 large shield, +3 bracers of armor, a robe of the archmagi, and casts the mage armor spell on herself. This is not a very wise ensemble -- every single item in question provides an "armor" bonus, so none of them stack with any of the others (excepting the chainmail and shield, as usual). The highest AC bonus comes from the combination of suit of armor (5 + 2 = +7) and shield (2 + 1 = +3), so that is the only operative protection. Final AC: 10 + 7 + 3 = 20.

Example 10: A character wears +3 chainmail, a +2 large shield, a +1 amulet of natural armor, and a +5 ring of protection. The chainmail with its "enhancement" bonus provides an improved "armor" bonus (5 + 3 = +8), and so does the shield (2 + 2 = +4), and these two items stack (just like any suit of armor and shield are allowed to do). The amulet provides "natural armor" (+1), so this stacks, too (see the description on DMG p. 207). Finally, the ring lends yet a different protection, a "deflection" bonus (+5), so this stacks with everything else, as well (DMG p. 194). Final AC: 10 + 8 + 4 + 1 + 5 = 28.

Example 11: A character wears +2 full plate, has three-quarters cover behind a +4 tower shield, and also has a functioning shield spell. The full plate provides an "armor" bonus (8 + 2 = +10). The shield spell provides a "cover" bonus (+7). Meanwhile, the magic tower shield provides a "cover" bonus from hiding behind it (+7; see PH p. 106 for use of the tower shield, and PH p. 132-133 for how cover works), which does not stack with the shield spell, and also a separate "armor" bonus from the magic enchantment on it (+4), which does stack with the suit of armor as normal. Final AC: 10 + 10 + 7 + 4 = 31. (You may wish to consult Dragon magazine #280 for more details on positioning tower shields. The fact that a tower shield's magic enhancement provides an "armor" bonus was clarified by personal email between myself and Skip "the Sage" Williams on 9/21/01).

Example 12: A 10th-level monk with 16 Dexterity and 18 Wisdom is given a +3 large shield, a +2 amulet of natural armor, a +1 ring of protection, and receives the spells mage armor and shield of faith. Any character with 16 Dexterity gets a bonus to AC (+3 according to PH p. 8); since this bonus is of unnamed type, it will stack with anything else. A monk's "sixth sense" ability usually lends them a special AC bonus from class, level, and Wisdom, but carrying a shield (a type of armor) causes this bonus to be entirely lost (as per PH p. 39). As usual, the magically enhanced shield provides an "armor" bonus (2 + 3 = +5), and so does mage armor (+4), so they fail to stack and only the former is counted. Likewise, the ring is a "deflection" bonus (+1), and so is the shield of faith spell (+2), so in this case only the latter is applied. The amulet provides "natural armor" (+2) which stacks with all of the preceding. Final AC: 10 + 3 + 5 + 2 +2 = 22. (The fact that a shield counts as a type of armor, especially for this purpose, was confirmed by email between the Sage and Guy Fullerton on 5/29/01, and is documented here: http://homepage.mac.com/guyf/DnD/Sage/MonkShield.html.)

To see how the armor-stacking rules worked in previous editions of the AD&D rules, see here.