He might turn to his studies more intensively. Since he has no friends to distract him, he could pour all his energy into learning new spells and magic, becoming more powerful in the process.
In some versions, Harry would be deeply depressed at first. But then he realizes that he can't let this break him. So he begins to explore the more hidden and forgotten parts of Hogwarts, like the Chamber of Secrets (if it's been reopened in the fanfic). There, he discovers new powers or artifacts that help him not only cope but also become a more independent and self - reliant wizard.
Harry could start to rely on his inner strength and the memories of his family. Remembering his parents and their sacrifice gives him the motivation to keep going, even without his friends. He might also form a bond with some of the Hogwarts ghosts or other outcast characters who understand his situation.
Harry might cope by retreating into his own thoughts and memories of his parents and the wizarding world. For example, he could think about the good times at Hogwarts to endure Vernon's torture.
He might be very sad at first. Harry has always valued his friends, so being forgotten by them would be a huge blow.
After Sirius dies, Harry is in a really tough place. He feels like a part of his family has been ripped away. He may start to question his own actions that led to Sirius being in the Department of Mysteries in the first place. Harry will also feel a sense of loneliness, even with his friends around. But over time, he'll remember the lessons Sirius taught him, about being brave and standing up for what's right. This will give him the strength to move forward, and he'll use his memories of Sirius as a source of motivation in his fight against Voldemort.
He might focus on his studies. In the wizarding world, there are so many interesting magical subjects like Potions, Transfiguration. By burying himself in books and learning new spells, he can at least distract himself from the lack of friends.
In some fanfictions, Harry becomes more determined to fight against Voldemort. He channels his grief into training harder and becoming a stronger wizard. He often has flashbacks of Sirius which fuel his anger towards the Death Eaters and Voldemort, seeing them as the root cause of his loss.
Magic would surely play a big role. She could use a spell to numb the pain, like a modified version of the 'Relashio' spell but for pain relief. Also, she might use her Patronus to keep her company and give her the emotional support she needs during the difficult time.
He would probably try to figure out what went wrong. Harry is a curious and determined character. He might start to recall recent events to see if there were any signs of his friends' discontent. He could also try to reach out to them, either directly or through mutual acquaintances, to ask for an explanation.
One possible storyline could be that Harry discovers his friends have been influenced by dark magic or a powerful spell that makes them shun him. He then has to find a way to break the spell while also dealing with his own feelings of betrayal and isolation.
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.
It can also influence new fan creations. Some new fanfiction writers might be inspired by the more controversial 'Harry Potter Insults Fanfiction' to either create their own version of it or to create works that are a reaction against it. For instance, they might write stories that focus on healing the relationships that are damaged in the insults fanfiction.