Given a fraction $p/q$, first get it into its lowest terms (so that $p$ and $q$ have no common factor). Then, if $q$ is of the form $2^a5^b$ for integers $a,b$, its decimal expansion has max$(a,b)$ digits after the decimal point. If it's not of this form, its decimal expansion is non-terminating (but repeating).
Suppose you want to have a number $x$ whose decimal expansion is
$0.a_1a_2\cdots a_ka_1a_2\cdots a_k\cdots$. That is it has a period of length $k$, with digits $a_1$, $a_2,\ldots,a_k$.
Let $n = a_1a_2\cdots a_k$ be the integer given by the digits of the period. Then
$$\begin{align*}
\frac{n}{10^{k}} &= 0.a_1a_2\cdots a_k\\
\frac{n}{10^{2k}} &= 0.\underbrace{0\cdots0}_{k\text{ zeros}}a_1a_2\cdots a_k\\
\frac{n}{10^{3k}} &= 0.\underbrace{0\cdots0}_{2k\text{ zeros}}a_1a_2\cdots a_k\\
&\vdots
\end{align*}$$
So the number you want is
$$\sum_{r=1}^{\infty}\frac{n}{10^{rk}} = n\sum_{r=1}^{\infty}\frac{1}{(10^k)^r} = n\left(\frac{\quad\frac{1}{10^k}\quad}{1 - \frac{1}{10^k}}\right) = n\left(\frac{10^k}{10^k(10^k - 1)}\right) = \frac{n}{10^k-1}.$$
Since $10^k$ is a $1$ followed by $k$ zeros, then $10^k-1$ is $k$ 9s. So the fraction with the decimal expansion
$$0.a_1a_2\cdots a_ka_1a_2\cdots a_k\cdots$$
is none other than
$$\frac{a_1a_2\cdots a_k}{99\cdots 9}.$$
Thus, $0.575757\cdots$ is given by $\frac{57}{99}$. $0.837168371683716\cdots$ is given by $\frac{83716}{99999}$, etc.
If you have some decimals before the repetition begins, e.g., $x=2.385858585\cdots$, then first multiply by a suitable power of $10$, in this case $10x = 23.858585\cdots = 23 + 0.858585\cdots$, so $10x = 23 + \frac{85}{99}$, hence $ x= \frac{23}{10}+\frac{85}{990}$, and simple fraction addition gives you the fraction you want.
And, yes, there is always a solution and it is always a rational.
Best Answer
It suffices to prove the following statement: any non-mixed repeating decimal can be expressed as a fraction with denominator not divisible by $2$ or $5$.
Proof. Let $x$ be a real number with a non-mixed repeating decimal, given by $$ 0.\overline{x_1 x_2 x_3 \ldots x_n} $$ for some $n$ and digits $x_i$. Then let $$ A = 10^{n-1}x_1 + 10^{n-2} x_2 + \cdots + x_n < 10^n $$ so that \begin{align*} 10^nx = x_1 x_2 x_3 \ldots x_n.\overline{x_1 x_2 x_3 \ldots x_n} &= A + x \end{align*} Hence $$ x = \frac{A}{10^n - 1} \\ $$ and the denominator is not divisible by $2$ or $5$.