Basically, if you are a wizard with the War Caster feat carrying a shield and you cast shield, do you get both the bonus of your physical shield (+2 AC) and the bonus from the spell shield (+5 AC)?
When a wizard with the War Caster feat carrying a shield casts the Shield spell, does the AC bonus stack?
All bonuses to AC stack.
I assume you're thinking of previous versions of D&D, where bonuses of the same type didn't stack. However, in 5e, the majority of ways to gain AC are separate ways to calculate your base AC, such as Plate Armour, which sets your base AC to 18, or Mage Armour, which sets your base AC to 13 + Dex. From the Player's Basic Rules, page 9:
Some spells and class features give you a different way to calculate your AC. If you have multiple features that give you different ways to calculate your AC, you choose which one to use.
Actual bonuses to AC are very rare in 5e, and stack fully with each other and with different sources of AC, unless the source or the bonus specifies otherwise. An example of this is the Monk's Unarmoured Defense ability, which specifies that it only applies when you are not carrying a shield. Note that it says nothing about the Shield spell, so that would function normally.
An example of non-stacking bonuses is the physical shield itself, which specifies that you can benefit from only one shield at a time. So carrying 2 shields only gets you a +2 bonus. (Player's Basic Rules, pg 44.) Note that the Shield spell provides you with 'an invisible barrier of magical force', not a (lowercase) shield. (Player's Basic Rules, pg 100.) So it does not come under this exception and stacks with a physical shield without difficulty.
So a shield stacks with the Shield spell, and both of them stack with any armour you are wearing, or Mage Armour if you have that instead.
Just to be hyper pedantic, even if the "bonuses" don't stack, a shield doesn't give a "bonus".
Wielding a shield increases your Armor Class by 2
As far as I can find, it's the only time this wording is used.
\$\begingroup\$ Welcome to RPG.SE! Take the tour if you haven't already, and check out the help center for more guidance. \$\endgroup\$– V2Blast ♦Jun 2, 2022 at 23:35
Yes, the benefits granted by a shield and by the Shield spell stack.
A shield does not provide a bonus, instead it increases your base AC. One can read in the basic rules (in the PHB the wording is the same):
Armor Class (AC). Armor protects its wearer from attacks. The armor (and shield) you wear determines your base Armor Class.
Shields. A shield is made from wood or metal and is carried in one hand. Wielding a shield increases your Armor Class by 2. You can benefit from only one shield at a time.
Hence, while you are using only a shield your base AC is 12, not 10. This is confirmed by the Sage Advice Compendium:
What about a shield? A shield increases your AC by 2 while you use it. For example, if you’re unarmored and use a shield, your AC is 12 + your Dexterity modifier. Keep in mind that some AC calculations, such as a monk’s Unarmored Defense, prohibit the use of a shield.
There are some spells that provide temporary bonuses to the AC, which can be added to the base AC since they are different game features. Among such spells one may find Shield and Shield of Faith: the latter is the example reported in the Sage Advice Compendium which confirms that this is the correct reading:
Once you have your base AC, it can be temporarily modified by situational bonuses and penalties. For instance, having half cover gives you a +2 bonus to your AC, and three-quarters cover gives a +5 bonus. Spells sometimes modify AC as well. Shield of faith, for example, grants a target a +2 bonus to AC until the spell ends.
\$\begingroup\$ In this answer I am missing a reason, why it is important that a Shield is not a bonus? The rules from Xanathars about "Combining Different Effects" do not require them to be bonuses, although they do mention bonuses in the example. But in general they can be any source of an effect. \$\endgroup\$– finduslJun 13, 2022 at 17:28
They do not stack, and it is not a bad thing either
This is another one of those cases, where what we think the rules should say, or maybe even want the rules to say, and what they actually say differ.
If a DM thinks this is nonsensical, they are entirely at liberty to overrule the rules as written.
Why shield and a shield do not stack, rules as written
Both features have the same name, "shield", so they will not stack. In this case, as the shield spell is the more potent one (+5, rather than +2 from a physical shield), it will win out.
By default bonuses and effects in 5e stack. The exception to this is on page 252 DMG, Combining Game Effects, for game features that have the same name:
Different game features can affect a target at the same time. But when two or more game features have the same name, only the effects of one of them - the most potent one - apply while the durations of the effects overlap. (...) Game features include spells, class features, feats, racial traits, monster abilities, and magic items.
While the list does not list non-magical equipment explicitly, a game feature is anything and everything in the game, including equipment.
The physical shield and the shield spell do share the same name, down to capitalization, as spells by default are spelled in lower case within the rules, for example on p. 202 PHB "Other spells, such as the shield spell, affect only you.".
Eddymage's answer points out that a normal shield is not providing a bonus, but changing the base AC. The DMG stacking rule however is not limited to bonuses or concerned about how the effects work, only about how they are named. A shield changing the base AC by two points and shield increasing it with a +5 bonus are both featuers of the same name, causing an effect that increases the creature's AC.
How to narratively exlain this
You can rationalize this as both effects creating an obstacle between you and incoming attacks. The magical force one is a lot better, but both really have the same function. Physical shields do not stack with each other either, even though you could have one on every arm, so why should a magical and a physical one stack?
Why this is not a bad thing
@findusl observes that interpreting shield this way also helps address the problems caused by characters that exploit stacking to achieve extremely high AC, effectively breaking bounded accuracy.
It is easy to underestimate what the effect of exceeding the bounded AC range is. An increase of just 2 points in AC increases survivability by up to 200% if the monsters already have a hard time to hit you.
Even on tier one, wearing normal platemail and shield with Defensive fighting style you have a permanent AC 21, and with shield stacking to AC 26 will be out of the range what most monsters reasonably can hit without a crit. (Optimized builds can get to even higher base ACs).
When your base AC is already high, you do not need to cast shield that often, you only need it in case you actually get hit. So with just a few spell slots from taking the Eldritch Knight subclass of fighter or a few levels of sorcerer, you can last most of the day with a "virtual" AC that is that high.
This causes real issues for play balance, because to hit that character, the DM needs monsters that would just maim normal characters, or if they keep to monsters with normal to hit rates, they effectively cannot really hit that character. What are they to do?
In our group, the DM lets them stack. When our Sorcerer-Paladin casts shield, their AC shoots up to 27. Our DM has taken to nearly always target the low AC rogue instead, with the justification that the monsters understand someone in plate mail would be hard to hit, which causes frustration both for the Paladin, who rarely gets to have the character shine with their best feature, and the rogue, who feels unfairly targeted. It has led to ongoing bad experiences, all of which would be much less of an issue, if shield would not stack with a shield.
\$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$– Someone_Evil ♦Jun 3, 2022 at 9:59