A function $g(x)$ is said to be an even function if $\forall x \in \mathbb{R}$, we have $g(-x) = g(x)$. The naming even function arises from the fact that the functions $g(x) = x^{2n}$ where $n \in \mathbb{Z}$ i.e. the function which takes the even powers satisfy this condition since $(-x)^{2n} = x^{2n}$.
Similarly, a function $g(x)$ is said to be an odd function if $\forall x \in \mathbb{R}$, we have $g(-x) = -g(x)$. The naming odd function arises from the fact that the functions $g(x) = x^{2n+1}$ where $n \in \mathbb{Z}$ i.e. the function which takes the odd powers satisfy this condition since $(-x)^{2n+1} = -x^{2n+1}$.
The claim is that any function can be written as a sum of an even function and an odd function.
Note that $$f(x) = \left(\frac{f(x) + f(-x)}{2} \right) + \left(\frac{f(x) - f(-x)}{2} \right)$$
Now note that if we let $$E(x) = \left(\frac{f(x) + f(-x)}{2} \right)$$ then $E(x)$ is an even function since $$E(-x) = \left(\frac{f(-x) + f(-(-x))}{2} \right) = \left( \frac{f(-x) + f(x)}{2} \right) = \left(\frac{f(x) + f(-x)}{2} \right) = E(x)$$
Similarly, if we let $$O(x) = \left(\frac{f(x) - f(-x)}{2} \right)$$ then $O(x)$ is an odd function since $$O(-x) = \left(\frac{f(-x) - f(-(-x))}{2} \right) = \left( \frac{f(-x) - f(x)}{2} \right) = -\left(\frac{f(x) - f(-x)}{2} \right) = -O(x)$$
Hence, we have that $E(x)$ is an even function and $O(x)$ is an odd function such that $f(x) = E(x) + O(x)$. Hence, any function can be written as a sum of an even function and an odd function.
The thought process and the motivation is as follows. We want to write $f(x)$ as $E(x) + O(x)$, where $E(x)$ is an even function and $O(x)$ is an odd function. Hence, we have $E(x) + O(x) = f(x)$. Replacing $x$ by $-x$, we get that $E(-x) + O(-x) = f(-x)$. Since we enforce that $E(x)$ is even and $O(x)$ is odd, we get that $f(-x) = E(x) - O(x)$. Hence, we have that $$\begin{align} E(x) + O(x) & = f(x)\\ E(x) - O(x) & = f(-x) \end{align}$$ Solving the above gives us $$\begin{align}E(x) & = \frac{f(x) + f(-x)}{2}\\ O(x) & = \frac{f(x) - f(-x)}{2}\end{align}$$