Timelapse of a Japanese spider crab molting. This is the largest arthropod on Earth, with leg spans up to 3.8 meters/12.6 feet and weights of 19 kilograms/41 pounds. The video was shot over six hours in the Enoshima Aquarium in Fujisawa, Japan.
As for the mechanics behind the molt, this from the Alaska Fisheries Science Center about king crabs:
Prior to molting, a crab reabsorbs some of the calcium carbonate from the old exoskeleton, then secretes enzymes to separate the old shell from the underlying skin (or epidermis). Then, the epidermis secretes a new, soft, paper-like shell beneath the old one. This process can take several weeks.
A day before molting, the crab starts to absorb seawater, and begins to swell up like a balloon. This helps to expand the old shell and causes it to come apart at a special seam that runs around the body. The carapace then opens up like a lid. The crab extracts itself from its old shell by pushing and compressing all of its appendages repeatedly. First it backs out, then pulls out its hind legs, then its front legs, and finally comes completely out of the old shell.
Over the next few weeks, the crab gradually retracts all of its body parts from the outer shell by a few millimeters, while it begins to secrete a new shell beneath the old one. When a crab molts, it removes all its legs, its eyestalks, its antennae, all its mouthparts, and its gills. It leaves behind the old shell, the esophagus, its entire stomach lining, and even the last half inch of its intestine. Quite often, many crabs in a population molt at the same time of year, and their old shells wash up on the beach. If you find something on the beach that looks like a dead crab, pick it up, open the lid, and look closely inside. If nobody is home, it is a cast-off exoskeleton.
A king crab may molt 20 times in its life. After hatching out as a planktonic larva, it molts 4 times, at 1-2 week intervals, before becoming a small crab. In its first year of life, it may molt 6 more times. The time between molting (the inter-molt period) gets longer with every molt. A 2-year old crab may molt only 3 times, a 3-year old only twice. By the time they are 4 years old, king crabs will molt only once per year. They become sexually mature at about 5 years of age. After that, the females must molt every year in order to mate, but the males molt less and less often. Very old males may not molt for 3 years or more.
To say this is an amazing process is a major understatement, and it has been the focus of research by many scientists for decades. Molting takes place about 15-20 times in the life of a crab. A king crab may molt six times in its first year, four in its second, two or three times in it’s third, and after that, perhaps only once a year. After sexual maturity, the females continue to molt annually, while intermolt periods become continuously longer for the males, so that they only molt once every few years or so.
(Photo from here)
This is actually a lobster larva, but you get the idea.