He could start by having an honest conversation. Just sitting down with his friends and explaining his side of the story, whatever it may be. Clear communication is often the first step in mending relationships.
His friends could play a crucial role. For instance, Annabeth could remind him of all their past victories and how they overcame seemingly impossible odds. Just like in the original series, her logical thinking and belief in Percy could start to chip away at his hopelessness.
Later, he could become depressed. Harry has always valued his friends highly, so losing them would be a huge blow. He might isolate himself in his dormitory, not participating in school activities as much. He would probably be constantly thinking about what went wrong and how to fix it.
He could regain it through the support of his friends. If Hermione and Ron show him unconditional love and support, and remind him of all the good he has done and all the people he has saved. Their friendship has always been a strong bond in his life, and it can be the key to bringing him back from the brink. Also, if new friendships are formed, like with some previously overlooked characters who offer him new perspectives on life.
Maybe his friends betrayed his secrets. In many fanfictions, a friend might accidentally or deliberately let out something Harry had confided in them, like his fears about Voldemort or his feelings for a certain girl. This could shatter his trust.
He could find a new purpose. Maybe he starts to focus on helping the younger generation of wizards, teaching them how to defend themselves. This gives him a sense of hope for the future and reignites his will to live.
The husband should focus on forgiveness, although it's not easy. He can start by trying to understand the reasons behind his wife's cheating. Maybe there were problems in the relationship that both of them overlooked. By forgiving, he is not saying that what she did was okay, but rather that he is willing to move forward. He can also engage in activities together with his wife that they used to enjoy. This can help them reconnect and start to rebuild the trust that was broken.
Well, in some fanfictions, it could be through a powerful magic spell cast by a very skilled wizard. Maybe Dumbledore left behind a special spell in his old notes that Hermione discovers and uses on Harry.
He could start with meditation. By clearing his mind, he might be able to focus his magic better. Just like how in real life people use meditation to gain self - control, in the fanfiction world, Harry could do the same to tame his magic.
Harry could try to change his appearance or behavior slightly if they are the things that make others avoid him. But more importantly, he should communicate his true self to others. He can share his stories, dreams, and fears. This vulnerability can make others feel closer to him. He might also need to seek out those who are more accepting and open - minded. Maybe there are some outcasts or loners like him in the fanfiction world, and they can form a group together first and then gradually expand their social circle.
He might have used magic prosthetics. With the help of his friends like Hermione, who is brilliant at magic research, they could have found a way to create a magical arm that functions almost like a real one.