So, if I'm reading this right, you're saying that A.) the PCs should be able to resolve an encounter given to them,
Nope, never said that.
B.) if for any reason they don't succeed, then it's obvious that the DM made the encounter too difficult?
You should know the characters your players are playing. If you know that the highest Arcana check in the group is +10, then making the DC to decipher the script 40 should obviously tell you that you intend for the group not to be able to deal with their challenge on their skill alone. Even if you make it DC 20, you should be prepared for them to need assistance 45% of the time. The distinction is that, as DM, you get to set the difficulty at a level that determines whether the challenge is able to be accomplished with the direct skill of the characters. This is just as planned as if you make the DC a 10 when "Arcana Guy" has a +30 Arcana check.
And in doing so should probably already plan for the PCs to need the help of an NPC?
Depends on how much a DM prefers to prep ahead. If he likes winging the Sage encounter, that's fine. But calling the encounter "unplanned" when it is actually "unprepared" is the difference.
That would be pointless and very poor DMing in any case.
Pre-planning reasonable courses of action the players might take is pointless and bad DMing? I beg to differ. I don't have to prep the Sage encounter, but I may well want to keep that eventuality in mind as a common thing one might do when unable to resolve the issue themselves.
So, ultimately, this would equate to the the DM making sure that the PCs always succeed at every encounter placed before them, with no risk of failure.
I never said this either.
Not to mention that you didn't take into account something the game is based around, random die rolls. Random rolls being the determining factor between success and failure.
I took it into account, I just didn't mention it since it is a basic premise of the game. But a DM can also make those random die rolls irrelevant by placing the DC too high or too low for a level-appropriate challenge.
Maybe I'm wrong, but I think that's how it's suppose to work. Without risk of failure the game would devolve into something resembling a poorly implemented interactive story.
You're not wrong about no risk of failure. But I never built my premise around 'no risk of failure.'
As a player who has played in every edition of the game to date, I know just how poorly dice can roll, in every encounter, within a single session, regardless of how easy or hard the encounter is designed.
Yes, dice are fickle and some days I set aside the new pretty dice and pull out the worn out 30-year-old crayon-filled dice. Welcome to the grognard club.
But, the dice can be as fickle as they want to be when it comes to skill checks. Without the auto-fail and auto-hit feature that attack rolls have a character with a +10 Arcana can never fail an encounter requiring an Arcana check of 11 or less and can never succeed at one requiring a 31 or more. So it is not as 'regardless' as you claim.
I'm sorry but I just can't follow that line of reasoning, it just seems too far off the mark.
I'll go so far as to say that Good DMs
do anticipate courses of action their players may take and give some thought to non-mandatory encounters. Ad-libbing an encounter does not automatically make it worse, some people are good at that. But pre-planning can improve anyone's ability to provide a more interesting encounter.
Open up a copy of Keep on the Borderlands and look at the NPCs the author prepared for use when the PCs came looking for their aid.