Don't use \\ in the text, do a blank line in the code to move to the next line.
There are several possible ideas.
The showframe package to visualize margins
\documentclass{book}
\usepackage{showframe}%<-- comment this line in the final doc
\usepackage{paracol}
\usepackage{graphicx}
\usepackage{caption}
\parindent=0pt
\begin{document}
\section{Simple Pendulum in margin}
Consider a pendulum as shown
do a blank line in the code to move to the next line.
\marginpar
{\includegraphics[width=\marginparwidth]{example-image-b}
\captionof{figure}{Simple Pendulum}}
%
\section{Simple Pendulum with paracol}
\begin{paracol}{2}
Consider a pendulum as shown
\switchcolumn
\begin{figure}
\includegraphics[width=\linewidth]{example-image-a}
\caption{Simple Pendulum}
\end{figure}
\end{paracol}
\end{document}

Images/pendulum.pngwithexample-image-ain your code. – Dr. Manuel Kuehner Dec 12 '22 at 02:48