What is the difference between M30 and M02?+−
Both end the program. The classic difference is that M30 rewinds the pointer to the first block and leaves the control ready to repeat the part, while M02 ends where it is. On many modern controls they behave the same, but since that depends on the machine, the sensible thing is to use M30 every time.
Does M30 stop the spindle and shut the coolant?+−
On most machines yes, because the PLC provides for it. Even so it is not an obligation of the code, and it depends on the builder. The shop habit is to write M05 and M09 in the closing blocks, which also makes clear to whoever reads the program what state is expected at the end.
Does M30 cancel the G54, the G43 or cutter compensation?+−
It depends on control parameters. There are machines set up to return to the initial state after end of program and others that keep the modals. Since you cannot know without looking at the machine, the practical answer is to cancel what matters by hand with G40, G49 and G90 before the M30.
Do the axes have to go to the reference point before M30?+−
It is not compulsory, but it is strongly recommended: leaving Z up and the table in a comfortable position lets you load the next part without fighting the tool, and it means the next program always starts from the same place. G91 G28 Z0. is enough in most cases.
How do I make the program repeat on its own with nothing to touch?+−
By replacing the M30 with an M99 in the main program, which restarts from the first block. It only makes sense on machines where the next part comes in on its own, with a bar feeder or with automation, and it should be written with the block delete slash in front so the operator can break the loop from the panel.