Before you start, shake water off your hands. Faced with a drier I know to be feeble, I use a flicking motion where I tuck all fingers under the thumb then spread them wide, several times. Do this over the sink, not the floor ;-)
While under the air, your hands should be in motion at all times. There are two motions to combine/alternate.
Motion 1 is to cup the ball of your thumb in the fingers of the opposite hand, then slide those fingers around the back of the first hand, then along the backs of the fingers. Then cup what was the "opposite" hand in the fingers of the first hand, repeat in reverse. This is basically a classic "hand-washing" mime.
Motion 2 deals with the fact that the classic "hand-washing" mime doesn't separate your fingers: you need to spread and interlock your fingers, rubbing the sides of the fingers against those of the opposite hands. I generally need less of this than of Motion 1.
Be alert to the feel of the air on your hands: you don't want all this cupping to mean that your hands are shielding each other from the air half the time. Don't clench them together, keep them fairly open and loose, and avoid the temptation to close the "inner" hand into a near-fist while the outer hand rubs the back of the fingers.
Some time after you're getting really bored of this, you'll feel your hands go quite quickly from sliding wetly over each other, to feeling more friction. At this point they are almost dry, but actually still a little moist to the touch. If you aren't planning to shake hands with anyone immediately you walk away, this is probably dry enough, otherwise you might want to stick at it even longer.
If you're wearing rings then the skin under the ring pretty much is going to stay damp. Tough.
The goal is that every part of the surface of your hands is regularly brushed by another part of the surface of the opposite hand. That way, anywhere that water might otherwise collect is disturbed, and the water spread onto other parts of your hands that are drying. Beyond this principle, the exact details can be whatever works for you.
In practice, I agree with Zach that it's generally not worth the bother. Pro-tip, I find that the shirt in the small of my back is a more inconspicuous place to dry my hands than my trousers. But then, I often wear a loose shirt or a sweater over a T-shirt.
The air that comes out is often either too hot or too cold
Cheap hand-dryers are hardly going to optimize your comfort. If you aren't in pain then just keep at it. If you are in pain then move your hands down (further away) or give up entirely. Even cold air has some drying effect, but if it's clearly taking longer than you have patience for, bail out.
the period during which the air comes out is way too long
Maybe I'm missing something, but if your hands are already dry and the air is still blowing you've won. Just leave.
Finally, if you're worried about the hygiene of the thing then carry your own clean paper towels, and/or apply an evaporating hand-sanitizer after washing and drying your hands. For that matter, if you're worried about the hygiene of hand-washing then reading techniques for scrubbing for surgery is instructive (I'm not bothered myself, but I do get bored at the dentist's and they have a wall chart at mine)