Prove the generalization of the midpoint rule formula I saw in Wikipedia the following formula:
$$\displaystyle\int_0^1 {f(x) \, dx} = \sum_{m=1}^M {\sum_{n=0}^\infty {\frac{\left({-1}\right)^n+1}{{\left(2M\right)^{n+1}}\left({n+1}\right)!} {{\left. f^{(n)}(x) \right.}_{\left|x=\frac{{m-\frac12}}{M}\right.}}}}$$
I wish to know how it was found, or how to prove it.
I guess they have just taken a Taylor series of the function, and set points with a pace of $\frac{1}{M}$?
Can anyone prove this equality?

$f(a+t)=\sum_{n=0}^\infty f^{(n)}(a) t^n \frac{1}{n!}$
$\int_{a-b}^{a+b} f(x)dx=\sum_{n=0}^\infty f^{(n)}(a) b^{n+1} \frac{1}{(n+1)!}-\sum_{n=0}^\infty f^{(n)}(a) (-b)^{n+1} \frac{1}{(n+1)!}=\sum_{n=0}^\infty f^{(n)}(a) (-1^n+1) b^{n+1} \frac{1}{(n+1)!}$
Taking $a=\frac{m-1/2}{M}$, $b=\frac{1}{2M}$:
$\int_{\frac{m-1}{M}}^{\frac{m}{M}} f(x)dx=\sum_{n=0}^\infty \frac{\left({-1}\right)^n+1}{{\left(2M\right)^{n+1}}\left({n+1}\right)!} {{\left. f^{(n)}(x) \right|}_{x=\frac{{m-1/2}}{M}}}$
$\int_{0}^{1} f(x)dx=\sum_{m=1}^M \int_{\frac{m-1}{M}}^{\frac{m}{M}} f(x)dx=\sum_{m=1}^M\sum_{n=0}^\infty \frac{\left({-1}\right)^n+1}{{\left(2M\right)^{n+1}}\left({n+1}\right)!} {{\left. f^{(n)}(x) \right|}_{x=\frac{{m-1/2}}{M}}}$
