Well, perhaps Snape sets them to clean the potions classroom. Draco tries to boss Harry around at first, but Harry refuses to be pushed. As they clean, they accidentally knock over a vial that releases a magical mist. The mist makes them relive some of their worst memories involving each other. This forces them to understand each other's perspectives better and by the end of detention, there's a less hostile air between them.
It could change in a more positive way. In detention, they might have to rely on each other to get through Snape's tasks. If they are made to work on a complex magical experiment, they would need to communicate. This communication could break down some of the barriers between them. Maybe they start to exchange a few friendly words outside of detention, slowly building a more amicable relationship.
In a Harry and Snape detention fanfiction, Harry might finally have a chance to understand Snape better. He could see that Snape's strictness is not just pure malice but perhaps a result of his complex past. Snape, on the other hand, could start to see Harry not just as James Potter's son, but as an individual with his own struggles. They might end up having a conversation about magic that neither expected, leading to a newfound respect for each other.
Well, Harry could be forced to clean the Potions classroom during detention. Snape might make him scrub every cauldron by hand while muttering about how clumsy Gryffindors are. Harry might accidentally spill a potion ingredient, which makes Snape even angrier and gives him more tasks to do, like sorting out all the potion ingredients in the store cupboard.
Their relationship can develop as they are forced to spend time together during detention. Harry might start to see Snape's tough exterior as a mask for his insecurities or past traumas. For example, when Snape shares a bit of his knowledge about a difficult potion, Harry realizes Snape is not just out to get him.
One interesting scenario could be that during detention, Snape makes Harry clean all the potion bottles in the dungeon while lecturing him about the importance of precision in potions. Harry, in turn, discovers an old, forgotten potion recipe among the bottles and Snape is grudgingly impressed.
To make a Harry and Snape detention fanfiction interesting, you can focus on their character development. For example, show Snape's internal struggle between his dislike for Harry based on his past with James and his duty as a teacher. For Harry, explore his growing understanding of the adult world and how Snape fits into it. Also, add some mystery elements like a hidden potion ingredient that they discover during the detention.
Perhaps in the fanfiction, Snape assigns Harry to clean all the old potion vials in the storage room during detention. While doing so, Harry discovers an old diary that seems to hold secrets about Snape's past at Hogwarts, which then leads to a series of revelations and a change in their relationship.
Harry would probably be quite resentful at first. He might think Snape is just being his usual unfair self. So, he would be sulky and do the tasks reluctantly.
Some fanfictions have the idea that while in detention, Harry and Snape are magically bound to work together on a special potion. This potion has the power to reveal hidden secrets. As they work on it, they start to share their own secrets, like Snape's unrequited love for Lily and Harry's fears about Voldemort. It's a really interesting way to develop their relationship.