Here is how you find the continued fraction for any number at all. Say the number is $x_0$.

First, let $a_0$ be the largest integer that does not exceed $x_0$. That is, $a_0 = \lfloor x_0\rfloor$. And let $b_0$ be the fractional part of $x_0$, that is $b_0 = x_0 - a_0$. In our example, $$\begin{align}x_0&=\pi,\\ a_0 &= 3,\\ b_0 &= 0.14159\ldots.\end{align}$$

Now we write $$\begin{align}x_0 & = a_0 + b_0 \\ & = a_0 + \frac{1}{x_1}\end{align}$$ where $x_1 = \frac1{b_0}$. In this case we have $x_1 = \frac{1}{0.14159\ldots} = 7.0625\ldots$.

Then repeat: let $a_1 = \lfloor x_1\rfloor, b_1 = x_1-a_1,$ and $x_2 = \frac1{b_1}$. In this case we have $a_1 = 7, b_1 \approx 0.0625\ldots$, and $x_2 = 15.996\ldots$. At this point have $$\pi = 3 + \cfrac{1}{7+\cfrac{1}{15.996\ldots}},$$ and in general $$x_0 = a_0 + \cfrac{1}{a_1+\cfrac{1}{x_2}}$$

Repeat again: let $a_2 = \lfloor x_2\rfloor, b_2 = x_2-a_2,$ and $x_3 = \frac1{b_2}$. In this case we have $a_2 = 15, b_1 \approx 0.996\ldots$, and $x_3 = 1.003\ldots$.

Repeat as desired, or stop if $x_i$ becomes 0, which will happen if and only if the original $x_0$ was rational.

The $a_i$ are the terms of the continued fraction expansion.

For expressions like $$\frac{e-1}{e+1}$$ there is an algorithm you can use, due to Bill Gosper, which takes the continued fraction for $e$ as input and emits the terms of $\frac{e-1}{e+1}$ as output. The algorithm is too long to describe in detail here, but you can read it in Gosper's original monograph or a shorter explanation here. The algorithm will actually calculate $$\frac{ax+b}{cx+d}$$ for any integer $a,b,c,d$ and continued fraction $x$; for $\frac{e-1}{e+1}$ you need to take $a=c=d=1, b=-1,$ and $x=e$.

Note that this does *not* require a decimal approximation for $e$; all it requires is the continued fraction for $e$, which is simple: $[2; 1,2,1,1,4,1,1,6,1,1,8,1\ldots]$. The Gosper monograph also gives an algorithm for extracting a continued fraction for $\sqrt x$ when the continued fraction for $x$ is known.

You asked how to know, when calculating a continued fraction for $\pi$, how much precision you need in the input decimal. Suppose you have calculated that $\pi \approx [p_0; p_1, p_2, \ldots p_n]$. Then you know that $$[p_0; p_1, p_2, \ldots p_n]\lt \pi \lt [p_0; p_1, p_2,\ldots, p_{n-1}]$$ if $n$ is even, or with the inequalities reversed if $n$ is odd. Now the $[p_0; \ldots]$ parts are rational numbers, so you can look at the denominators and see if your approximation to $\pi$ was good enough to justify continued fractions of that precision.

You also asked how, if you don't already have a decimal expansion for $\pi$, you can calculate the continued fraction. The answer is, you calculate it the same way that you calculate the decimal expansion for $\pi$ in the first place: by using the terms of an infinite series. For example, you might use the well-known series $$\sum_{k=0}^\infty\frac{2^{k+1} k!^2}{(2k+1)!}=\pi.$$ Each term of this series is a single rational number. You can start with $x=0$ and use the Gosper algorithm to accumulate the terms into $x$, extracting a term of output when possible, because $x' = x+\frac pq = \frac{qx+p}{0x+q}$ which has the required form. Whenever the integer part of $x$ and $x'$ is the same, that is the next term of the continued fraction for $\pi$; otherwise, set $x←x', x'←x'+\frac pq$ where $\frac pq$ is the next rational number in the series, and continue. (Disclaimer: I have not actually tried this, but it might work.)