I have an equation $$-z e^{-z} = (x-z) e^{x-z}$$ where $z=\frac{r S}{P}$ and $x=\frac{r y (P-S)}{P}$. I know that $-z \in (-\infty,-1)$ and $x-z \in (-1,0)$ with $x \neq 0$. Is there any way to solve this to find an expression for S?
Of course, $x-z = W(-z e^{-z})$, but as far as I can see this does not bring me any closer.
$$ (x-z)\, e^{x-z}+z\, e^{-z} =0 \tag 1$$ where $$z=\frac{r S}{P}\qquad \text{and} \qquad x=\frac{r y (P-S)}{P}$$
Replace $x$ and $z$ in $(1)$; simplifying, what remains is $$e^{\frac{r y (P-S)}{P}}=\frac {(1+y)S+Py } S$$ Divide each side by $e^{r y}$ to obtain $$\large\color{blue}{e^{-\frac{r y}{P}S}=\frac{(1+y)} {e^{r y}}\,\frac{S+\frac{Py}{1+y} }S}$$ which, for $S$, has a solution in terms of the generalized Lambert function (have a look at equation $(4)$ in the linked paper).
If, on the search bar of the site, you type
generalized Lambert function, you should find $225$ results.