I'm attempting to derive the following formula for Bayesian Improved Surname Geocoding (BISG) as described in the literature. BISG is used for calculating the expected probability of an individual's race based on their surname and geographic location, given that geolocation and surname are statistically independent conditional on race.
$$P(R_i=r|G_i=g,S_i=s)=\frac{P(R_i=r|S_i=s)P(G_i=g|R_i=r)}{\sum_{i=1}^{n}P(R_i=r|S_i=s)P(G_i=g|R_i=r)}$$
given $G_i \perp S_i|R_i$
Based on my understanding of Bayes theorem and the chain rule, the formula ought to be (simplifying notation):
$$P(R|G,S)=\frac{P(G,S|R)P(R)}{P(G,S)}$$ $$=\frac{P(G|R)P(S|R)P(R)}{P(G,S)}$$ due to the independence assumption, and $$=\frac{P(G|R)P(R|S)P(S)}{P(G,S)}$$ since $P(S|R)P(R)=P(R|S)P(S)$.
But the next step to the final formula eludes me.
In the condensed notation. $\mathsf P(R,G,S)=\mathsf P(S)\,\mathsf P(R\mid S)\,\mathsf P(G\mid R)$ as you had, and by Law of Total Probability, $\sum_\mathrm R\mathsf P(\mathrm R,G,S)=\mathsf P(S)\sum_\mathrm R\mathsf P(\mathrm R\mid S)\,\mathsf P(G\mid\mathrm R)$ so...
$$\begin{align}\mathsf P(R\mid G, S)&=\dfrac{\mathsf P(R,G,S)}{\mathsf P(G,S)}\\[1ex]&=\dfrac{\mathsf P(R,G,S)}{\sum_\mathrm R\mathsf P(\mathrm R,G,S)}\\[1ex]&=\dfrac{\mathsf P(R\mid S)\,\mathsf P(G\mid R)}{\sum_\mathrm R\mathsf P(\mathrm R\mid S)\,\mathsf P(G\mid\mathrm R)}\end{align}$$
The indexing on your original formulae is incorrect. We are summing over the supported values of $R_i$, not the subscripts. Let $\mathcal R$ be that support, then:
$$\mathsf P(R_i\,{=}\,r\mid G_i\,{=}\,g, S_i\,{=}\,s)=\dfrac{\mathsf P(R_i\,{=}\,r\mid S_i\,{=}\,s)\,\mathsf P(G_i\,{=}\,g\mid R_i\,{=}\,r)}{\sum\limits_{\rho\in\mathcal R}\mathsf P(R_i\,{=}\,\rho\mid S_i\,{=}\,s)\,\mathsf P(G_i\,{=}\,g\mid R_i\,{=}\,\rho)}$$