By keeping it's body nearly vertical while it's wings beat forwards and backwards. It is actually flying upwards just fast enough to Balance it's body weight less that it stay still. A ruby - throated humming bird, which weighs less than 4g has no beat it's wing more than 52 times a second to hover in front of a flower
Img source: https://www.southernliving.com/garden/things-hummingbird-lovers-know-video
Thanks for reading hope you learned something new. :)
xoxo Lynn.