In some fanfictions, they could leave Hogwarts to protect their friends. If they are being targeted by a powerful enemy, they might think that leaving the school will draw the danger away from their classmates and teachers. They would rather face the challenges alone than put others at risk.
One reason could be to search for a powerful magical artifact outside of Hogwarts that they believe is crucial for defeating a new dark threat. In fanfiction, they might feel that Hogwarts has become too dangerous or restricted in terms of resources for their mission.
Maybe he leaves because of a conflict with the Hogwarts staff. If the new headmaster or some teachers start implementing rules that Harry believes are wrong or unfair, like restrictions on defensive magic classes, he might decide to leave in protest.
One reason could be the media attention. After all they've been through, they might be tired of constantly being in the spotlight. The British wizarding press could be hounding them, so they leave to get some privacy.
He might leave Hogwarts in fanfic due to a sense of disillusionment. Maybe he discovers some dark secrets about the school or the wizarding world in general that make him question his place there. It could be something related to the way the school is run or a conspiracy among the teachers that he stumbles upon.
One possible reason could be that he feels constantly in danger at Hogwarts. With all the dark magic threats and attacks that keep happening, he might think leaving would keep his friends and himself safer. For example, after the Chamber of Secrets incident, he might have considered leaving to protect others from Voldemort's influence.
It could also be due to personal reasons related to his growth and self - discovery. The events of the Triwizard Tournament might make him realize that he needs to find his own path outside of Hogwarts for a while. He might feel that the school can't offer him the answers or the experiences he needs at that moment to become stronger and more independent.
One possible reason could be a misunderstanding. Maybe they misinterpreted something Hermione said or did, and in a fit of anger or confusion, they decided to leave. For example, if Hermione was working on a project alone without consulting them, they might have felt left out and left in a huff.
In fanfiction, one reason could be his desire for a fresh start away from the memories at Hogwarts. Maybe he feels he has done all he can there and wants to explore new magical knowledge elsewhere.
One reason could be that she might be on a secret mission. In some fanfictions, she could be trying to find a powerful magical artifact outside the walls of Hogwarts to save the wizarding world from a new dark threat. She might believe that she can't achieve this while staying within the school's confines.
One reason could be to find peace. After all the chaos and war in England, they might just want to get away from it all and start fresh somewhere else.
Maybe she leaves because of a conflict. It could be with a teacher who doesn't support her unorthodox ways of learning or a fellow student who makes Hogwarts an unpleasant place for her. In fanfiction, there could be a lot of creative interpretations of such conflicts.