To understand the Fourier pedagogy, first you have to deal with periodic functions. Only periodic functions, at first.
$$ x(t+P) = x(t) \quad \text{for all } t $$
That has period of $P$ (and also a period of $2P$ and $3P$, but we won't worry about that for the time being).
Fourier (and Euler) postulate that this other periodic function of the same period can, within a certain limit, approach the periodic $x(t)$
$$ x(t) = \sum\limits_{n=-\infty}^{+\infty} c_n e^{j 2 \pi \frac{n}{P} t} $$
and, given that postulate, the Fourier coefficients, $c_n$, come out to be
$$ c_n = \frac{1}{P}\int\limits_{t_0}^{t_0+P} x(t) e^{-j 2 \pi \frac{n}{P} t} \ dt $$
Now this only decomposes periodic $x(t)$. To decompose a non-periodic $x(t)$, you have to approximate that with a periodic $x(t)$ with an extremely long period (i think in electronics, a period of a year would more than suffice) and then, in a limit, let that period go to infinity. I guess with an infinitely long period, a periodic function would no longer be periodic. This is what leads to the Fourier integral and is another big mathematical effort. But the OP should get this down first.