This writeup won't be long, because the key idea is simple.
If you like a girl, there is a technique that will usually end up blowing your chances with her.
Explicitly tell her, too early, that you like her.
That's it. As simple as that.
It would be better to show your feelings with warmth, natural friendliness, and not be obsessively attached to any particular outcome.
If you instead get fixated on a goal, and make your desires explicit, you will put her on the spot and make her feel uncomfortable enough that she will always, from then on, feel awkward around you. So to relieve the stress she might distance herself with belittling humor, or with a flat rejection.
Maybe it's important to explain also that telling her can be done in different ways. It doesn't have to be in words. Anything that makes it undeniably clear to her that your interest in her is romantic will have the same effect. Once you do this, she is sure to not be yours. For example, giving her some flowers counts as telling her. But wait! Before you vote this down, don't get me wrong, please read the next part.
Before you object with your own counterexamples, please pay close attention to the "too early" part of the formula. If the girl has already made it abundantly clear to you that she likes you and hopes you like her, then, and only then, is telling her that you like her a good idea. And after that, flowers are always a great idea.
And if you do want to get the girl? I don't know the formula for that one. But do avoid tipping your hand too early.