In this post, I assume that $A$ is symmetric $>0$ (in particular invertible) and $B$ is invertible.

$\textbf{Proposition}$. i) Equation (1) generically admits $2^n$ real solutions $X$.

ii) There are equations (1) that do not admit any stable solutions (in the sense: $X$ is stable iff for every $\lambda\in spectrum(X), Re(\lambda)<0$).

$\textbf{Proof}$. i) I use the Robert's idea which is clearly a good one.

Let $S=XB^TA$ (necessarily a symmetric matrix). (1) is equivalent to

(2) $SUS+S-A=0$ where $U=A^{-1}B^{-T}B^{-1}A^{-1}$ is symmetric $>0$.

Thus (2) is a symmetric Riccati equation; GENERICALLY, it has only symmetric real solutions. Beware, (for example) if $U=A=I_n$, then there are non-symmetric solutions.

Note that (2) is equivalent to

(3) $Y^2+Y-AU=0$ (where $Y=SU$) or (3') $(Y+1/2I)^2=1/4I+AU$.

Note that $spectrum(AU)\subset \mathbb{R}^+$ and that $AU $ is diagonalizable. Generically (3') admits $2^n$ real solutions and, consequently, (2),(1) too.

ii) A (randomly chosen) example with no stable solution is as follows for $n=3$.

$A= \begin{pmatrix}2901/250& -687/100& -5479/500\\-687/100& 967/200& 3041/500\\-5479/500& 3041/500& 5507/500\end{pmatrix}$

$B= \begin{pmatrix}63& 76& 59\\89& -41& 9\\-15& 50& -24\end{pmatrix}$.

EDIT. I just read the good answer of @Federico Poloni ; yet, if I understand the OP's question (that is difficult because he changes his mind easily), we must add the so called Robert's condition: $(R)$ "$XB^TA$ is symmetric"; then the problem becomes more complicated.

Assume that $A>0$; then Federico shew that the general solution of $(4)$ (OP's notation) is $X=LQ-1/2AB$ where $L=\sqrt{A+1/4ABB^TA}$ is invertible and $Q$ is an arbitrary orthogonal matrix. Then, when we add the condition $(R)$, putting $U=B^TAL^{-1}$ (note that $rank(U)=rank(B)$), it remains to solve the non-obvious system in the unknown $Q$

$(*)$ $QU=U^TQ^T,QQ^T=I$.

The previous system generically has $2^n$ real solutions, as mentioned in the first part of my post. Yet, the result using the Federico'post is better because we assume only that $A$ is invertible and we do not suppose anything about $B$.

Of course, when $rank(B)<n$, the system may have an infinity of solutions. For example, some numerical tests give for $n=4$ and $U$ a random matrix

if $rank(U)=3$ then $16$ solutions. If $rank(U)=2$, then an infinity of solutions that depend on $1$ parameter.

EDIT 2. We can solve $(*)$ as follows

We consider the SVD of $U$: $VUW=diag(\sigma_1I_{i_1},\cdots,\sigma_{k-1}I_{i_{k-1}},0_{i_k})$ where the $\sigma_i> 0$ are distinct.

We seek $P\in O(n)$ s.t. $PVUW$ is symmetric. We obtain $P=diag(P_1,\cdots,P_{k-1},P_k)$ where $P_1,\cdots,P_{k-1}$ are orthogonal symmetries ($P_j^2=I_{i_j}$) and $P_k\in O(I_{i_k})$. The number of parameters for $P_j,j<k$ is $floor({i_j}^2/4)$ and for $P_k$ is $i_k(i_k-1)/2$.

Note that $WPVU$ is symmetric and that the set of required $Q$ is the set of $WPV$.

Remark. When the singular values of $U$ are distinct, $P=diag(\pm 1,\cdots,\pm 1)$ and we find the $2^n$ solutions of the generic case.