  Using the new methodology introduced in a recent Letter [Phys.\ Rev.\ Lett.\
{\bf 123}, 231104 (2019)], we present the details of the computation of the
conservative dynamics of gravitationally interacting binary systems at the
fifth post-Newtonian (5PN) level, together with its extension at the
fifth-and-a-half post-Newtonian (5.5PN) level. We present also the sixth
post-Newtonian (6PN) contribution to the third-post-Minkowskian (3PM) dynamics.
Our strategy combines several theoretical formalisms: post-Newtonian,
post-Minkowskian, multipolar-post-Minkowskian, gravitational self-force,
effective one-body, and Delaunay averaging. We determine the full functional
structure of the 5PN Hamiltonian (which involves 95 non-zero numerical
coefficients), except for two undetermined coefficients proportional to the
cube of the symmetric mass ratio, and to the fifth and sixth power of the
gravitational constant, $G$. We present not only the 5PN-accurate, 3PM
contribution to the scattering angle, but also its 6PN-accurate generalization.
Both results agree with the corresponding truncations of the recent 3PM result
of Bern et al. [Phys.\ Rev.\ Lett.\ {\bf 122}, 201603 (2019)]. We also compute
the 5PN-accurate, fourth-post-Minkowskian (4PM) contribution to the scattering
angle, including its nonlocal contribution, thereby offering checks for future
4PM calculations. We point out a remarkable hidden simplicity of the
gauge-invariant functional relation between the radial action and the
effective-one-body energy and angular momentum.
