Intuition behind the derivative of dirac delta function
Solution 1:
Suppose the spikes in the smooth approximation to $\delta'(x)$ are located at $x=-h$ and $x=h$.
When $\bar{x} \approx x+h$, the smooth approximation to $\delta'(x-\bar{x})$ will be large and positive, so the integral will roughly pick up "something large" times $f(x+h)$. Similary, for $\bar{x} \approx x-h$, the integral will pick up the same large factor times $f(x-h)$, but with the opposite sign. So if that large factor turns out to be of the magnitude $\frac{1}{2h}$, the integral will be roughly $$ \frac{f(x+h)-f(x-h)}{2h} = \frac{\bigl(f(x) + h \, f'(x) + O(h^2)\bigr) - \bigl(f(x) - h \, f'(x) + O(h^2)\bigr)}{2h} , $$ which tends to $f'(x)$ as $h \to 0$.
Solution 2:
Use the nascent delta function based on the hat function: $$ \delta_h(x) = \begin{cases} 0 & |x|\geq h \\ x/h^2 + 1/h & -h \leq x \leq 0 \\ -x/h^2 + 1/h & 0 \leq x \leq h \end{cases}. $$ The derivative of this nascent delta function is $1/h^2$ on $[-h,0],$ $-1/h^2$ on $[0,h],$ and 0 everywhere else. So $$ \int_{-h}^{h} \delta_h'(x)f(x) \,dx = \int_{-h}^{0} \frac{f(x)}{h^2} \,dx + \int_{0}^{h} \frac{-f(x)}{h^2} \,dx = - \frac{F(h) - 2F(0) + F(-h)}{h^2} $$ where $F$ is the antiderivative of $f.$ The limit of the rightmost term as $h\rightarrow 0$ is the negative second derivative of $F$ at 0, that is $-f'(0).$
To understand the origin of the higher order derivatives of the Dirac delta function, you need to use the normal distribution based nascent delta function: $$ \delta_h(x) = \frac{1}{h\sqrt{\pi}} \exp(-x^2/h^2). $$ In a computer algebra system, compute $$ \int_{-\infty}^{\infty} \delta_h^{(n)}(x-a) x^k \,dx $$ for some integer $n\gt 1$ and some integer $k \geq n.$ The answer will be $$ (-1)^n k! / (k-n)! a^{k-n} + \text{terms containing positive powers of $h$} $$ that is, $(-1)^n$ times the $n$th derivative of $x^k$ evaluated at $a$ in the limit $h\rightarrow 0.$