Ideally, the size of the bet should be exactly enough for the other player to be indifferent between chasing the flush and dropping the hand. That's the correct mathematical approach. After the flop, a flush draw has 35% chance of hitting on the turn or on the river. If you go all in and the other player has to pay less than 35% of the final pot (including his stack) to call, it's porfitable for them to do it. If they have to pay exactly 35%, they are indifferent. Just so you have an idea, if they had 33% chance of hitting their outs, the optimal stack size to go all in would be the size of the pot (because their call would represent 33% of the final pot)
It's a little bit harder to figure this out if you're not going all in on the flop because the other player has to predict if you're betting again on the turn or not. From the flop to the turn and from the turn to the river, they have about 19% chance of hitting the flush on each street, so they should be paying no more than that to see those cards, but other things come to play like implied odds. If you bet 1/2 pot on both streets, they would be paying 25% of the pot on each street, which is a bad price for them. Any time they pay more for a draw than they should, the profit is yours in the long run.
In conclusion, you should put them in hard positions, facing tough decisions. If you bet slightly above what they should be calling, they will not always correctly evaluate their situation and will make the wrong calls. If they end up getting their flush, you got unlucky, but it will be worse for them in the long run because they are overpaying for that draw. You don't have to largely overbet to make them fold because then you're the one not being payed enough for your equity.