You look at the definition.
> latexdef sim
\sim:
\mathchar"3218
The initial 3 tells you this is a relation symbol. Similarly
> latexdef oplus
\oplus:
\mathchar"2208
tells you that \oplus is a binary operation symbol.
You can also look in Scott Pakin's “Comprehensive List” with texdoc comprehensive or online on texdoc.org where you find \sim in table 89 “Binary relations”.
Or you can do a test that can tell you about a symbol being a \mathrel or a \mathbin (you'd get \relax in other cases).
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\BinOrRel}[1]{%
\binrel@{#1}\texttt{\string#1 is \meaning\binrel@@}%
}
\makeatother
\begin{document}
\BinOrRel{\sim}
\BinOrRel{\oplus}
\BinOrRel{\sum}
\end{document}

\binrel. It is impressive how we discover new tools every day... Thanks. – Sigur Nov 29 '23 at 17:29