Here are a few ways in which you could help your child deal with faliure:
Resist the urge to offer solutions
There will be times when your child feels left out by his friends or fails at a particular task or game and comes home crying to you. Do offer him support and comfort but try not to jump in to offer solutions. Instead encourage him to talk about his feelings, brainstorm about possible solutions that he can think of and discuss healthier coping mechanisms. This can be achieved by asking open ended questions like - "How did you feel when your friends left you out of the team?", "The next time this happens how do you think you can handle the situation differently?" Even if you think his ideas may not work, don't reject them but coax him to think of more possibilities.
Coax them out of their comfort zone
Most children have a favourite game or hobby and will naturally veer towards the same activities every time. Sometimes they may be afraid to try playing games that they are not good at for fear of ridicule or failure. Teach them to be adventurous and try new things even if they feel that they may not succeed. Explain to them the importance of being open to possibilities and play even if it does not guarantee a win each time. You can share with them your own attempts to try activities outside your comfort zone and how you dealt with it.
Give equal importance to effort
Try not to focus too much on the result of a game. Instead laud the effort that they put in and be specific about your appreciation. Motivate them to compete with themselves rather than to compare with others. Resist from over praising your child as he will then constantly look for external validation. Instead of always saying, "You are so smart, you can do it", you could say, "You have worked really hard at this and I appreciate the efforts that you have put in." This shifts the focus on the efforts which are more in his control rather than on the result which isn't always in his control. It will also teach him to accept failure and not get demoralized by it and encourage him to pick himself up after every fall. Of course you should praise him when required but try not to overdo it.
Teach them impulse control
Now you might wonder what impulse control has to do with dealing with failure! Various experiments conducted by experts have revealed that delayed gratification helps children cope better with frustration and failure. It is important for children to realize early on, that things might not always work out the way they want it to. For instance if they have been eyeing an expensive toy and have been pestering you to buy it for them, try not to give in immediately. Help them understand that you may not be able to afford it right now and they may have to wait for the right time. Use the opportunity to encourage them to save up and pitch in with their contribution. They will not only learn to temper their impulses but also value prudent expenditure.
Be aware of your own expectations
We often tend to burden our children with our own expectations and views. Do resist the urge to pressurize them with your opinions. Be careful about how you react to poor performance in exams, games or competitions. Your own attitude to achievement will filter down to your children. Encourage them to reflect on what went wrong rather than lecturing them on their study habits or poor time management. Let them come up with their own thoughts and solutions. Be a good role model in the way you deal with your own frustrations and failures whether at work or otherwise. Share your experiences of failure with your children so that they will do the same when they fail.
Teaching your child to be emotionally resilient will go a long way in helping him deal with setbacks even later in life. How he handles failure and what he does to pick himself up after every fall will help him succeed in his endeavours. This does not mean that you don't step in when your child is bullied or humiliated or in danger. He needs your active support at such times. But do use teachable moments like when you are watching movies or games to help him understand the role that training and practice have in achieving success. And the most important lesson that we all need to learn is that - "Failure is an event, not a person", as quoted by Zig Ziglar.