The 2 claws or hooks on each pretarsus (end segment of each leg), grip rough or penetrable surfaces so that makes it easy to move anywhere on those surfaces, including upside down.
On slippery surfaces, a flexible pad between those 2 claws forms a sort of “suction” against those smooth surfaces with a secretion from a gland called the Arnhart or tarsal or arolium gland.