How does a fly land on the ceiling?

So this fly is flying along, legs down, and somehow lands on the ceiling, legs up. How did he do that? Did he do a half loop, a half roll, or simply hit the ceiling and tumble into a legs-up position?

Here’s what Cecil had to say about it: "How does a fly land upside down on the ceiling?"

Basically, it does an upsidedown somersaut.