Robert answered in the case when there is no hypothesis about $B$. When $B$ is skew ($B\in SK$), there are, in the generic case, always solutions in symmetric $X$ ($X\in S$).
Assume that the eigenvalues of $A$ are distinct and let $f:X\in S\rightarrow AX-XA\in SK$. Then $dim(\ker(f))=n$ (the set $P(A)$ of polynomials in $A$) and $rank(f)=(n^2+n)/2-n=(n^2-n)/2=dim(SK)$, that is, $f$ is onto. Finally, the set of solutions is in the form $X_0+P(A)$, where $X_0$ is a particular solution.
EDIT. $f$ is onto IFF the eigenvalues of $A$ are distinct.
Proposition. If $A$ has only $2$ distinct eigenvalues with multiplicities $p,q=n-p$, then $rank(f)=pq\leq n^2/4$.
Proof. We may assume that $A=diag(\lambda I_p,\mu I_q)$ with $\lambda\not=\mu$. It is easy to see that $dim(\ker(f))=(p^2+p)/2+(q^2+q)/2$ and to deduce that $rank(f)=(n^2+n)/2-dim(\ker(f))=pq$ that is $\leq n^2/4$.