A shield just adds a modifier to armor class (+1 in melee, +2 vs missiles), so you add that to whatever your armor class is, and enemy attacks are rolled against the total.
The basic rule for when you can use a shield is pretty much any time you are not surprised or in some way hindered from using it (maybe an enemy pikeman just lodged his pike into your shield and you can't swing it around to block the arrows coming from the other side).
If you want to get REALLY fussy and unreasonably 'realistic', you could say stuff like an attack coming from the right hand side (if your shield is in your left hand) ignores your shield because you just can't get it around fast enough, you could. But I don't think you should.