Deriving even odd function expressions
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}$$
This is more intuitive if one views it in the special case of polynomials or power series expansions, where the even and odd parts correspond to the terms with even and odd exponents, e.g. bisecting into even and odd parts the power series for $\:\rm e^{{\it i}\:x} \:,\;$
$$\begin{align} \rm f(x) \ &= \ \rm\frac{f(x)+f(-x)}{2} \;+\; \frac{f(x)-f(-x)}{2} \\[.4em] \Rightarrow\quad \rm e^{\,{\large \it i}\,x} \ &= \ \rm\cos(x) \ +\ {\it i} \ \sin(x) \end{align}\qquad$$
Similarly one can perform multisections into $\rm\:n\:$ parts using $\rm\:n\:$'th roots of unity - see my post here for some examples and see Riordan's classic textbook Combinatorial Identities for many applications. Briefly, with $\rm\:\zeta\ $ a primitive $\rm\:n$'th root of unity, the $\rm\:m$'th $\rm\:n$-section selects the linear progression of $\rm\: m+k\:n\:$ indexed terms from a series $\rm\ f(x)\ =\ a_0 + a_1\ x + a_2\ x^2 +\:\cdots\ $ as follows
$\rm\quad\quad\quad\quad a_m\ x^m\ +\ a_{m+n}\ x^{m+n} +\ a_{m+2\:n}\ x^{m+2n}\ +\:\cdots $
$\rm\quad\quad\, =\,\ \frac{1}{n} \big(f(x)\ +\ f(x\zeta)\ \zeta^{-m}\ +\ f(x\zeta^{\:2})\ \zeta^{-2m}\ +\:\cdots\: +\ f(x\zeta^{\ n-1})\ \zeta^{\ (1-n)m}\big)$
Exercisse $\;$ Use multisections to give elegant proofs of the following
$\quad\quad\rm\displaystyle sin(x)/e^{x} \ \ $ has every $\rm 4k\,$'th term zero in its power series
$\quad\quad\rm\displaystyle cos(x)/e^{x} \ \, $ has every $\rm 4k\!+\!2\,$'th term zero in its power series
See the posts in this thread for various solutions and more on multisections. When you later study representation theory of groups you will learn that this is a special case of much more general results, with relations to Fourier and other transforms. It's also closely related to various Galois-theoretic results on modules, e.g. see my remark about Hilbert's Theorem 90 in the linked thread.
This might be repeating parts of Sivaram's answer, but I think a reorganization might be enlightening.
Suppose we want to break $f$ into even and odd functions: $f(x)=E(x)+O(x)$ where $E(x)$ is even, that is $E(-x)=E(x)$, and $O(x)$ is odd, that is $O(-x)=-O(x)$. Simply from these considerations, we get $$ \begin{align} f(x)+f(-x) &=(E(x)+O(x))+(E(-x)+O(-x))\\ &=(E(x)+O(x))+(E(x)-O(x))\\ &=2E(x) \end{align} $$ and $$ \begin{align} f(x)-f(-x) &=(E(x)+O(x))-(E(-x)+O(-x))\\ &=(E(x)+O(x))-(E(x)-O(x))\\ &=2O(x) \end{align} $$ Therefore, $$ \begin{array}{} E(x)=\frac{f(x)+f(-x)}{2}&\text{and}&O(x)=\frac{f(x)-f(-x)}{2} \end{array} $$