Solution 1:

Let's assume that $g(x)$ is given and we try to find out $f(n)$

$$ f(n)=\sum_{i=1}^n g(i) $$

$$ f(n+1)=\sum_{i=1}^{n+1}g(i) $$

$$ f(n+1)-f(n)=g(n+1) \tag 1$$

We know Taylor expansion

$$ f(x+h)=f(x)+hf'(x)+\frac{h^2 f''(x)}{2!}+\frac{h^3f'''(x)}{3!}+.... $$

Thus

$$ f(n+1)=f(n)+f'(n)+\frac{f''(n)}{2!}+\frac{f'''(n)}{3!}+.... $$

If we put $f(n+1)$ taylor expansion in Equation $1$

$$f(n+1)-f(n)=g(n+1)$$ $$ f(n)+f'(n)+\frac{f''(n)}{2!}+\frac{f'''(n)}{3!}+....-f(n)=g(n+1) $$

$$ f'(n)+\frac{f''(n)}{2!}+\frac{f'''(n)}{3!}+...=g(n+1) \tag 2$$

$$ f(n)+\frac{f'(n)}{2!}+\frac{f''(n)}{3!}+\frac{f'''(n)}{4!}+...=\int g(n+1) dn $$

We need $f(n)$ if so we need to cancel $f'(n)$ . So we need to

$$ -\frac{1}{2} ( f'(n)+\frac{f''(n)}{2!}+\frac{f'''(n)}{3!}+...)=-\frac{1}{2}g(n+1) $$

$$ f(n)+ (-\frac{1}{2.2} +\frac{1}{3!})f''(n)+(-\frac{1}{2.3!} +\frac{1}{4!})f'''(n)+...=\int g(n+1) dn-\frac{1}{2}g(n+1) $$

$$ f''(n)+\frac{f'''(n)}{2!}+\frac{f^{4}(n)}{3!}+...=\frac{d(g(n+1))}{dn} $$

If you continue in that way to cancel $f^{r}(n)$ terms step by step, you will get

$$ f(n)=\int g(n+1) dn-\frac{1}{2}g(n+1)+\frac{1}{12}\frac{d(g(n+1))}{dn}+a_4\frac{d^2(g(n+1))}{dn^2}+a_5\frac{d^3(g(n+1))}{dn^3}+... $$

This is Euler-Maclaurin formula. (Please see also the Applications of the Bernoulli numbers). I just wanted to show Bernoulli numbers seen in one of the very important formulas in mathematics .

Where $$a_n=  \frac{B_n}{n!}$$.

Because If you try to find out the coefficients of $\frac{t}{e^t-1}$ by polynomial division. You can get exactly same coefficients that seen in Euler-Maclaurin formula.

The Bernoulli numbers appear in Jacob Bernoulli's most original work "Ars Conjectandi" published in Basel in 1713 in a discussion of the exponential series.

You can also see that The Bernoulli numbers appears in the power series of $tan(x)$. https://en.wikipedia.org/wiki/Taylor_series (Check the List of Maclaurin series of some common functions)


Proof: $$\frac{t}{e^t-1}=\frac{t}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}=1+\frac{(1-1)t-\frac{t^2}{2!}-\frac{t^3}{3!}-\frac{t^4}{4!}-...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}=1-\frac{+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}$$

$$\frac{t}{e^t-1}=1-\frac{t}{2}+\frac{+(\frac{1}{2}-\frac{1}{2!})t^2+(\frac{1}{2.2!}-\frac{1}{3!})t^3+(\frac{1}{2.3!}-\frac{1}{4!})t^4+...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}=1-\frac{t}{2}+\frac{(\frac{1}{2.2!}-\frac{1}{3!})t^3+(\frac{1}{2.3!}-\frac{t^4}{4!})t^4+...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}$$

$$\frac{t}{e^t-1}=1-\frac{1}{2}t+\frac{\frac{1}{12}t^3+\frac{1}{24}t^4+...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}=1-\frac{1}{2}t+\frac{1}{12}t^2+\frac{(\frac{1}{24}-\frac{1}{2.12})t^4+...}{t+\frac{t^2}{2!}+\frac{t^3}{3!}+\frac{t^4}{4!}+...}$$

Solution 2:

How about a solution using exponential generating functions? Begin with the conditions $B_0 = 1$ and $\sum_{k = 0}^{n} \binom{n+1}{k}B_k = 0$. Rearrange the latter identity to get $B_k = \frac{-1}{n+1}\sum_{k = 0}^{n-1}\binom{n+1}{k}B_k$. Apply the coefficients of the exponential generating function to get $$F(x) = \sum_{n = 0}^{\infty}\frac{B_nx^{n}}{n!} = B_0 + \sum_{n = 1}^{\infty}\sum_{k = 0}^{n-1}\frac{B_kx^{k}}{k!}\cdot\frac{x^{n-k}}{(n-k+1)!}.$$ By associativity, we can change the order of the summation to get $$F(x) = 1 + \sum_{k = 0}^{\infty}\frac{B_kx^{k}}{k!}\sum_{n = 1}^{\infty} \frac{x^{n}}{(n+1)!}$$
(the easiest way to see this is to make a table with entries associated with each $n$ and $k$, then grouping the terms based on $\frac{B_kx^{k}}{k!}$). Notice that the stuff in the second summation has closed form $\frac{e^{x}-1}{x} - 1$ so $$F(x) = 1 + \left(1 - \frac{e^{x}-1}{x}\right)F(x).$$ Rearranging the identity in-terms of $F(x)$ gives you the desired closed form for the generating function of $B_n$.