He might use magic spells. In the wizarding world, there could be spells specifically designed for memory modification or removal. Draco, being a skilled wizard, could have found or learned such a spell to carry out this act on Hermione.
In some fanfictions, Draco might be part of a dark magic ritual. This ritual could involve complex incantations and the use of dark potions. By performing this ritual on Hermione, he is able to remove her memory. However, this would likely have consequences for both Draco and Hermione, as dark magic often has unforeseen side - effects.
In some fanfictions, Draco humiliates Hermione by showing her up in front of their professors. He could answer a difficult question that Hermione was about to answer correctly but he gets there first and then makes a comment like 'Even a Mudblood should know not to be so slow' which is a really cruel way in the context of the Harry Potter universe.
Another way is through her Gryffindor courage. She won't back down from a confrontation with Draco and will use that to her advantage. If Draco tries to bully her or her friends, she'll stand up to him and tease him about his cowardice in picking on those who are weaker. For example, 'Only a coward would target someone smaller, Draco. I thought Slytherins were supposed to be brave?'
He may start off very formal. Since Draco was brought up in a pure - blood family with strict etiquette, he would likely greet Hermione's family with a certain level of formality at first. For instance, a polite bow or a very proper handshake.
Hermione could become withdrawn. She might isolate herself from her friends for a while, spending her time in the library trying to make sense of it all. She might also feel a sense of betrayal, especially if they had some sort of understanding or relationship developing.
It could also be out of jealousy or spite. In some fanfictions, Draco might be jealous of Hermione's intelligence or her relationships with others. By removing her memory, he could be trying to make her more dependent or to get revenge in a cruel way.
At first, they're likely to be shocked. But then they start to understand each other more. Draco might become more protective of Hermione, and Hermione might see a different side of Draco. They go from being rivals to having a family - like bond.
In many of these fanfictions, Draco starts as a rather conflicted character. His care for Hermione challenges his ingrained beliefs. For example, in some stories, he has to go against his pure - blood upbringing. As he cares more for Hermione, he becomes more empathetic. He starts to see the world from her perspective, which makes him question the discrimination he was taught. His development often includes learning to be more selfless as he puts Hermione's needs before his own pride.
Well, Draco could be very conflicted. On one hand, he has his own pride and his Slytherin upbringing which might tell him to stay away. But if he has developed deeper feelings for Hermione in the fanfic, he might put aside their past differences. He could start by using his family's resources to find a cure or at least better treatments for her cancer. He may also become more protective of her, keeping her away from those who might be unkind about her illness.
Hermione might be initially very hurt and angry. She's a proud and strong character. She could cut Draco off completely and refuse to have any communication with him. When Draco shows regret, she may be skeptical at first. After all, he has broken her trust. But deep down, she might still have some feelings for him, so she could be in a state of internal conflict.
Hermione might become more morally ambiguous. Normally she is a very just and rule - following character, but by tricking Draco into Azkaban, she steps into a grey area. She could start to question her own actions and feel guilty.