Mainsail or Octoprint?

Is Mainsail the better Octoprint?
How do I use Octoprint in conjunction with a “Klipper printer”?

It's not necessarily better, but is specifically built for use with klipper. The official install instructions for Klipper detail the use of OctoPrint and how to configure it to use with Klipper.

I suspect you may be asking about "klipper printer" where it's been integrated to the printer directly? In those cases it will really depend on the hardware used by the manufacturer and if it's locked down or not. If you can SSH to it then you would be able to install OctoPrint using octoprint_deploy or KIAUH for example.

Thanks for the answers. I can imagine that it is not easy to answer such general questions. I'll try to find something in the official Klipper manual.

I found this diagram from the Klipper Ecosystem!