How would you go about solving the matrix equation $RSR - S = X$ for $S$?
Some background:
What I really want to find is a 'nice' formula for the sum
$$ S = \sum_{i=0}^n R^i A R^i $$
where $A, R$ are matrices (and, if it helps, we know that $A = \mathbf{u}^T \mathbf{v}$ for known column vectors $\mathbf{u}, \mathbf{v}$).
The form is somewhat similar to that of a geometric series, so the best attempt at some form of a formula that I could come up with was to start by saying
$$ RSR - S = P^{n+1}AP^{n+1} - A $$
... which leads back to the titular question...
Assuming that the sum exists, you could proceed by vectorization (column-stacking) followed by matricization (column-unstacking).
First define the variables $$\eqalign{ B &= R^T\otimes R &\implies B^k = (R^T)^{k}\otimes R^k \cr a &= {\rm vec}(A) &\implies A = {\rm Mat\,}(a) \cr s &= {\rm vec}(S) &\implies S = {\rm Mat\,}(s) \cr }$$ Then vectorize the equation $$\eqalign{ S &= \sum_{k=0}^n R^kAR^k \cr s &= \sum_{k=0}^n B^ka \,\,=(I-B^{n+1})(I-B)^{-1}a{\,\,\dot =\,\,}Ma \cr S &= {\,\rm Mat\,}(Ma)\cr }$$ where the geometric series was used to sum the $B$ matrices.