The legs of insects are remarkably complex and generally outperform human attempts to mimic their actions. Insects are able to move rapidly over uneven surfaces and adjust their legs to grip the terrain.
An insect will use the last segment of its leg, the tarsus, to contact and grip a surface. The tarsus is a narrow structure with little room for muscles and nerves. The muscles that move the tarsus are not located in the tarsus and all but in the previous segment, the tibia. The tibia is typically larger and allows more space for larger muscles. The joint between the tibia and the tarsus allows the tarsus to retract or promote.
The promotor muscles attaches directly to the joint of the tarsus and tibia. The retractor muscle is completely contained within the tibia and attaches to the tarsal claw by means of a long tendon. The tarsus typically contains several flexible regions (tarsomeres) that allow the tarsus to conform to a surface. The retractor muscles can bend the most distal tarsal segment inward opposed by the cuticle itself, but moving it in the opposite direction requires contact with a surface.
Contact between the leg and a surface is maintained by opposing contractions of the promotor and retractor. Promotion, or moving the leg forward causes the claws to release their grip and allows a leg to swing freely.