The sodium ions from the soy sauce poured onto the octopus cause voltage differences in its cells, which give the signals (rather than from the brain) for the muscles to contract. Of course the cells would have to still be alive after the animal's death for it to do that, which is why the twitching/dancing doesn't happen in cooked foods. SCIENCE