Failure is an inevitable part of everyone's work life. However big or small there will come a time when you will make a mistake, as tough as it may be at the time most failures can be successfully transformed into opportunities.
There is nothing worse than being 'found out'. The best thing you can do when you've messed up is be honest and upfront and confess. Let your mistake be known by stating facts and being frank and truthful.
2.) Explain but don't excuse
Now its time to explain the reason why the failure happened. Again stick to an honest and factual approach. Avoid making excuses that justify the mistake. For example "I didn't do enough research and the client was unimpressed" is a factual explanation of why you failed. Saying "I didn't do enough research because my laptop has been acting up and I wasn't feeling well the night before" is an attempt to justify the failure.
Now that you've outed your failure and explained how and why it happened, prepare to create a great strategy on how to move forward. It's great to be honest and admit where you failed but successful people are pro-active in their approach to fixing mistakes. How will you do better in the future? Can the situation be rectified? If so how? These are the questions to ask yourself. My having a strategy you can regain some trust that may have been lost.
4.) Be brave and move forward
Now that you've confessed your mistake and everyone knows what happened, don't become a retiring and awkward team member. Now its time to be brave, remain confident a mistake doesn't devalue your position, especially when you've already created a strategy to fix it or do better moving forward. Now approach your colleagues and day to day work with the same energy, enthusiasm and focus as always. Don't punish yourself or allow others to define you by your mistake, get over it and, learn from it and use it to ascend to a higher level of awareness and excellence.