The second conditional is used to talk about things which might happen, but which haven't yet happened.
1) Both "would" and " 'd " here express future in the past.CONTRACTIONS: 'Would' and 'had' are contracted to 'd; the way to distinguish them is simple because 'would' is always followed by a Base Form <base-form.html> and 'had', as an Auxiliary Verb <auxiliary-verb.html>, is followed by a Past Participle <past-participle.html>.
(If he was going to escape,) his hole would have to be as deep as his shovel, and he'd [have to be] able to lay the shovel flat across the bottom in any direction."
Use the the past simple tense 'was going to escape' to talk about future condition.
Use 'would' + base form ('have to be able to') to talk about future result.
He hasn't escaped; He's only thinking about it. The condition is not realized; The condition hasn't happened yet: 2nd conditional.
2) The sentence coming after 'warned that' in the following sentence is the 2nd conditional.
"She warned that if he failed to do this, he would be doomed for all of eternity."
'failed' is the condition and 'would be doomed' is the result. He hasn't 'failed', so he is not 'doomed for all eternity': 2nd conditional
All the best,
- For Teachers