Answer:
They use their legs which act like velcro to the surface they walk on.
Improved Answer:
The previous answer isn't entirely correct; stick insect feet are completely smooth, much unlike the hairy feet of flies, beetles and other insects. All stick insects have very specialised feet; each foot has a sucker and also two sharp claws, allowing them to walk up vertical walls and even upside down.