Molting is basically the same as shedding (ala snakes and lizards).
Crustaceans molt when growing. Their shells are hard and cannot expand when it grows so they shed their shells off as they develop a newer one underneath it. The new shell is soft and allows them to grow into the new shell until it hardens. Then the process starts again. During this soft-shell period, they become shy and hide for a little bit (sometimes hours, sometimes days). This is to protect themselves from predators since they are vunerable without their armor.
Commonly the animal will leave their molted shell out in the open as a "decoy". People often mistake them as the real animal that has died only to later discover their animal to come out of hiding and that it was just a molting they found.