I know the formula
$$ K_n = K_0 \cdot (1+r)^n $$
to get the balance after $n$ years with an interest rate $r$.
What if I'm adding 5 dollars to the principal each day. How can I find the balance after $n$ years? Will I have to make a recursive definition or can I use a smooth formula just as the one above?
What you are describing is the accumulated value of an $n$-year, level payment annuity. The key idea is that any payments into the fund at a particular point in time can be treated as its own separate quantity with respect to the calculation of interest. What I mean by this is that if I pay $A$ dollars at time $t = 0$, and $B$ dollars at time $t = 1$, then the accumulated value of the total payments at time $t = n$ is simply the sum of the individual accumulated values $$A(1+r)^n + B(1+r)^{n-1},$$ since $A$ has had the full $n$ time periods to accumulate interest, whereas $B$ has had only $n-1$ time periods to do so, since the payment of $B$ occurred at $t = 1$.
We can easily extend this idea to a series of regular level payments. Suppose I pay the same quantity $K$ (dollars) into a fund at times $t = 1, 2, 3, \ldots, n$ years, and this fund accumulates interest at a rate of $r$ per year, compounded annually. Further suppose that I wish to determine the accumulated value of the total payments at the end of $n$ years. The last payment at $t = n$ accrues no interest because it is made at the same time point as when I am interested in knowing the value of the fund. Its accumulated value is simply $K$.
The penultimate payment at time $t = n-1$ has only $1$ year to accrue interest and so its accumulated value is simply $K(1+r)$.
The payment before the penultimate one, at time $t = n-2$, has had $2$ years to accrue interest and its accumulated value is $K(1+r)^2$. And so on, until we reach the first payment, made at the end of the first year (time $t = 1$), which has had $n-1$ years to accrue interest, so its accumulated value is $$K(1+r)^{n-1}.$$ Therefore, the total accumulated value of the fund is $$\sum_{j=0}^{n-1} K(1+r)^j = K \frac{(1+r)^n - 1}{(1+r)-1} = K \frac{(1+r)^n - 1}{r},$$ using the formula for a finite geometric series. Notice that this formula is proportional to the value of $K$. So if I invest twice as much each year, the accumulated value is also twice as large. The other term, $((1+r)^n - 1)/r$, is commonly encountered and therefore has a special symbol to describe it: $$s_{\overline{n}\rceil r} = \frac{(1+r)^n - 1}{r}$$ is the symbol to describe the accumulated value of an $n$-term annuity-immediate with rate $r$ per term.
Now, what about your specific situation? Your payments are on a daily basis rather than a yearly one. This raises an issue of how the payments are compounded. If compounding occurs only once per year, then your daily payments of $x$ are really equivalent to a single annual payment of $365x$. If the compounding is daily, then the daily payments are equal to $x(1+r/365)^{365}$, where $r$ is the nominal annual interest rate. We can adjust the above formula easily to account for different payment schedules.
How about the initial principal? That of course is its own separate cash flow: so if your principal was $K_0$ at time $t = 0$, and your level payments are $K'_0$ (in your case, $5$ dollars per day), then the total accumulated value is again the sum of individual accumulated values: $$K_0(1+r)^n + K'_0 s_{\overline{365n}\rceil r/365}.$$ This is under the second assumption, where compounding occurs daily. Under the first assumption, the second term should be $365 K'_0 s_{\overline{n}\rceil r}$.
The only requirement for adding separate cash flows is that they are valued at the same point in time, in this case, the accumulated value is calculated at the end of $n$ years. You cannot add two cash flows that are valued at different points in time.