From your problem description, I assume the $x_i$ from the first two paragraphs are what is called $r_i$ later. I do not yet have a complete answer, but would like to point out some observations and ideas (sorry, I'm not allowed to write comments yet):

It seems to me that we can, without loss of generality, assume the $x_i$ to be commensurable. Otherwise, split $S\in\mathbb{Z}[r_1,\dots,r_n]$ into a representation wrt a basis of $\mathbb{Z}[r_1,\dots,r_n]$.

Thus, by multiplying through with a suitable constant, we can assume that the $r_i$ are positive integers. We may also assume $\gcd(r_1,\dots,r_n)=1$, since otherwise, any $S$ for which the equation has a solution is also divisible by this gcd, which allows dividing the whole equation.

The number of solutions for any particular $S$ and $r_1,\dots,r_n$ can be counted using generating functions (similar to Polya's method for counting possibilities of giving change); with your example $S=98\,a_1+99\,a_2$ and $0 \leq a_1,a_2 \leq 100$, the number of solutions for $S$ is the coefficient of $x^S$ in the polynomial $(x^{98}+x^{2\cdot98}+\cdots+x^{100\cdot98})\,(x^{99}+x^{2\cdot99}+\cdots+x^{100\cdot99})$, whose lowest exponent with coefficient larger than $1$ is $9899$.