The basic information that seems to be missing here is that a tikzpicture is really a box, like for example a character. Boxes are the fundamental thing in TeX (and LaTeX).
So look at the following example, that I hope is auto-explicative, to have a compendium of all the thing you can find in the Q&A I linked in my comment:
\documentclass{article}
\usepackage{lipsum,tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\lipsum[1-1]
The \texttt{tikzpicture} is really a character (or a \emph{box}) for \TeX.
Some text \tikz \draw (0,0) rectangle (1,1);
more text where I show that you can
change where the baseline of the box is:
\tikz[baseline={(1,1)}] \draw (0,0) rectangle (1,1);
And more text here
\tikz[baseline={(0,0.5)}] \draw (0,0) rectangle (1,1);
So if you have another paragraph here you can put it in the
margin as you do with any text.
So if you have another paragraph here you can put it in the
margin as you do with any text.\marginpar{%
\tikz \draw (0,0) rectangle (1,1);
}
So if you have another paragraph\tikzmark{a}
here you can put it in the
margin as you do with any text.
This one will be set on the mid of the page, 5cm down the top.
\tikz[overlay, remember picture]
\draw[red] ([yshift=-5cm]current page.north) rectangle ++(1,1);
And this one will be at the right of the mark set on the
third "paragraph" word in the previous paragraph.
\tikz[overlay, remember picture] \draw[red] (pic cs:a) rectangle ++(1,1);
And finally, given that the picture is a box, you can display it:
\begin{center}
\tikz \draw (0,0) rectangle (1,1);
\end{center}
Or even put into an equation:
\begin{equation}
A=\tikz[baseline={(0,0.5)}] \draw (0,0) rectangle (1,1);
\end{equation}
Or 5cm from the text margin position:
\noindent\hspace*{5cm}\tikz[baseline={(0,0.5)}] \draw (0,0) rectangle (1,1);
Or two-thirds away between tex margins:
\noindent X\hfill\hfill\tikz \draw (0,0) rectangle (1,1);\hfill X
\end{document}

Notice how the in-line \tikz are treated as if they were characters, and they change the line spacing accordingly. The overlay option makes the whole tikzpicture appearing as if it where 0-sized. The remember picture is needed so that the tikzmark library can process the positions across the compilation (you probably need to compile a couple of times to have the result shown here).
Also, the "reference" of the picture is not its center. To the external flow of text, what matters is the baseline; the default baseline is the bottom left corner of the whole picture, no matter the internal coordinates; you can change the baseline with the baseline option.
\tikzmarkwhere you wish to place an anchor which you can then use in atikzpicturethat hasremember picture, overlayas options. See https://ctan.org/pkg/tikzmark. You can also use the page anchors, such ascurrent page.west. I think there should be some examples on this site already. – Jasper Habicht Nov 11 '22 at 11:26xThere is nothing specific to tikz in the question. What your image shows is two paragraphs, each starting with an indent of\parskip, the second paragraph happens to start with a square rather than a letter. – David Carlisle Nov 11 '22 at 11:31xhorizontally in a LaTeX document"? – Evan Aad Nov 11 '22 at 11:33centerorflushleftenviroments or\hspace*or .... – David Carlisle Nov 11 '22 at 11:37tikzpictureenvironment is just a (possibly big) box. – Rmano Nov 11 '22 at 11:39