  Novel many-body and topological electronic phases can be created in
assemblies of interacting spins coupled to a superconductor, such as
one-dimensional topological superconductors with Majorana zero modes (MZMs) at
their ends. Understanding and controlling interactions between spins and the
emergent band structure of the in-gap Yu-Shiba-Rusinov (YSR) states they induce
in a superconductor are fundamental for engineering such phases. Here, by
precisely positioning magnetic adatoms with a scanning tunneling microscope
(STM), we demonstrate both the tunability of exchange interaction between spins
and precise control of the hybridization of YSR states they induce on the
surface of a bismuth (Bi) thin film that is made superconducting with the
proximity effect. In this platform, depending on the separation of spins, the
interplay between Ruderman-Kittel-Kasuya-Yosida (RKKY) interaction, spin-orbit
coupling, and surface magnetic anisotropy stabilizes different types of spin
alignments. Using high-resolution STM spectroscopy at millikelvin temperatures,
we probe these spin alignments through monitoring the spin-induced YSR states
and their energy splitting. Such measurements also reveal a quantum phase
transition between the ground states with different electron number parity for
a pair of spins in a superconductor tuned by their separation. Experiments on
larger assemblies show that spin-spin interactions can be mediated in a
superconductor over long distances. Our results show that controlling
hybridization of the YSR states in this platform provides the possibility of
engineering the band structure of such states for creating topological phases.
