Watching the starfish right itself after being flipped over I couldn't help but wonder how it did it? I'm guessing the legs reached up to find the ocean floor, and that caused the starfish to become unbalanced and roll over so it could right itself.
How did it then know to move away?
Starfish have a distributed nervous system, with each leg having its own mesh of nerves. The nervous systems of each of the legs are connected to a ring of nerves that circle its mouth. Starfish have no brains to coordinate its movement, each leg operates largely independently of the others.
Yet, as we see at the end of the video when it scurries away, there is something that allows one of the legs to somehow become the 'front' of the starfish and control its movement for awhile. Scientists don't know what that process is. There are simple eyes that can see only light and dark, as well as chemical receptors that can smell the water at the end of each leg. It is thought that triggering of those receptors is the catalyst that somehow allows one of the legs to control the starfish for a period of time.