So there are 2 answers to this question..

The best way is to connect your end stop to ground. The reason this is the best way is because it is ground we are playing with. If this wire were to short or chafe it will only latch ground to ground and have little affect on the rest of the printer past maybe that end stop not working. Because any and all metal on the robot should be latched to ground. So grounds are safer to play with wherever possible and power wires are things to take care of because there is the potential danger of shorts everywhere.

However, because we have the ability to adjust the firmware we can do whatever the hell we feel like doing. And so You can latch your endstop to signal and power if you like. There is nothing wrong with it. And it can and will work. You will just need to set it up differently in Marlin.

Marlin lets you choose whether the endstops are latched to a pullup or pulldown resistor. You can select all endstops to be latched or you can select individual endstops to be latched to one or the other. If your endstop is connected to a ground then you will want that endstop latched to a pullup resistor and if you want to drive your endstop with power then you will latch that endstop to a pulldown resistor in Marlin. So the controller sees a different state when the switch is open.

Because logic circuits, as it were, are actually kind of stupid. They only understand power or ground. They do not understand and often do not even see neutral or nothing. So the pullup or pulldown resistor is so when the switch opens the controller sees the opposite state.

Also in Marlin you can invert the logic for an endstop. This does exactly as it sounds. So instead of your Octopus looking for a switch from power to ground to know it has triggered a stop it will expect to go from ground to power. This has a use beyond just whether you are using power or ground. There is also a thing about how your endstop is wired. there are 3 pins on a microswitch. common, NO, and NC. depending on how we are wired at the endstop switch can also determine whether or not we want our endstop logic inverted.