One possibility is that they start by secretly exchanging glances during Hogwarts classes. Maybe Pansy begins to see Harry in a different light after he saves her from a dangerous situation in the Forbidden Forest. Their secret relationship could involve them meeting in hidden corners of the castle, sharing their thoughts and fears away from the prying eyes of their respective Houses.
At the beginning, they would be very cautious. Harry might be constantly worried about how his friends, especially Ron and Hermione, would react. Pansy would be concerned about losing her status among the Slytherins. As the story progresses, they could grow bolder. Maybe they start to take small risks like holding hands in semi - public places at Hogwarts. And towards the end, they might decide to come out publicly, facing whatever consequences come their way.
One way would be to communicate through enchanted objects. Like a special quill that writes messages only the other can see. Also, they might meet in secret locations such as an abandoned classroom or a hidden part of the Forbidden Forest. And when in public, they would be very careful with their body language and eye contact to avoid suspicion.
Perhaps it could start with secret glances in the hallways of Hogwarts. They might accidentally meet in a secluded corner of the library and start to have hushed conversations that gradually turn into expressions of affection.
In some fanfictions, they might become friends. After the war, they could realize that the old rivalries were pointless. Harry, being the forgiving person he is, might reach out to Pansy, and she, having seen the error of her ways, could accept his friendship. They could then work together to rebuild the wizarding world.
For Harry, he could start as being very hesitant about the whole situation. He still has his Gryffindor ideals and is not sure about marrying a Slytherin. But as he spends time with Pansy, he could become more open - minded. Pansy, on the other hand, could start as cold and distant. But as she gets closer to Harry, she could show her more vulnerable side, like her fear of not being good enough.
Hermione could be a common character. She might be initially skeptical or even opposed to the idea of a harem but eventually come around. Another could be Draco. His relationship with Pansy and his past enmity with Harry could add a lot of tension and intrigue to the story. Also, Ginny could be in it, perhaps trying to win Harry back or having to accept the new situation.
Harry may become more understanding of the Slytherin mindset. He realizes that not all Slytherins are bad, especially as he gets to know Pansy better through the marriage contract. He might start to see the value in their ambition and cunning in a different way.
Well, in fanfiction, the secret relationship might also involve some magical bond between Harry and Snape. Maybe a spell gone wrong or something that links them in a way that they have to keep it a secret. It could be that this bond makes them more empathetic towards each other's situations, with Harry realizing Snape isn't all bad and Snape seeing Harry as more than just James Potter's son.
Harry's character might become more complex. He'd have to deal with the judgment from his Gryffindor friends and the Hogwarts community in general. This could make him more introspective. Pansy would likely have to change her attitude towards Gryffindors. Her relationship with Harry could make her realize that not all Gryffindors are as bad as she thought. It could also lead her to be more inclusive and less likely to follow the typical Slytherin elitist mindset.