I saw this quote race through multiple versions on Reddit earlier today, and obviously no one really cares to attribute it correctly since I don’t expect anybody truly believes that Shakespeare said it. There’s nothing about this that suggests Shakespeare. In fact, it’s quite easy to find it attributed both to Abraham Lincoln as well as “ancient Chinese wisdom” if those make you think it’s got more or less credibility.
If you still want to believe it’s by Shakespeare, let me offer another bit of evidence : The word “failure” did not enter the English language until 1641. It very literally never shows up in Shakespeare’s works.