It's true that we learn from failure. But we don't learn how to succeed in the future, no matter what feeble-minded optimists like to believe. At most, we learn how to fail better, as Samuel Beckett informs us in a prose piece amusingly entitled Worstward Ho (1983).
Beckett is absolutely not telling us that if at first we don't succeed, we should try, try again in the hope and expectation that such endurance is bound to pay off. Rather, he's saying that no matter how hard you try, no matter how many times you fail, you will never succeed: that success is not even an option.
For we are fated to fail. We are destined to fail. We are doomed to fail. Such is the tragic character of our mortal being. The fact that Beckett affirms this and finds in it a source of darkly comic satisfaction, demonstrates that his is what Nietzsche would term a pessimism of strength (or, if you prefer, a Dionysian philosophy).
The fact that his words are to be found on a wide variety of motivational posters, mugs, and fridge magnets is also something that should cause laughter amongst Beckett enthusiasts, rather than despair and irritation. For as one commentator notes, observing corporate executives and New Age hippies draw comfort and inspiration from lines they have naively misunderstood is like watching someone innocently throw a stick for their dog, not realising that it is in fact a human shin bone they've just picked up in the park.