I will try to motivate the choice of substitution based on the known sum and difference results
\begin{equation*}
\sin(A+B) = \sin(A)\cos(B) + \cos(A)\sin(B), \\
\sin(A-B) = \sin(A)\cos(B) - \cos(A)\sin(B).
\end{equation*}
Observe that these look quite similar to one another, with the only differences being the sign of the final terms. We might then be prompted to add or subtract these two identities to discover another potentially useful relationship since some cancellation will occur if we do so. Adding gives
\begin{equation*}
\sin(A+B) + \sin(A-B) = 2 \sin(A)\cos(B). \tag*{(1)}
\end{equation*}
This identity essentially tells us that if we have a sum of the sines of two angles, we can express it as a product, but in this form, the result is not always convenient.
To see more directly what this result says about a sum of the form $\sin(u) + \sin(v)$, we can let $u = A+B$ and $v = A-B$. Then $(1)$ becomes
\begin{equation*}
\sin(u)+\sin(v)=2\sin(A)\cos(B),
\end{equation*}
where $A$ and $B$ are related to $u$ and $v$. Yet if we are starting on the left-hand side with $u$ and $v$, it is desirable to express the right-hand side completely in terms of $u$ and $v$ if possible. We can express $A$ and $B$ in terms of $u$ and $v$ by rearranging our substitutions and eliminating one variable at a time to get*
\begin{equation*}
A = \frac{u+v}{2}, \qquad
B = \frac{u-v}{2}.
\end{equation*}
Hence
\begin{equation*}
\sin(u) + \sin(v) = 2 \sin\mathopen{}\left(\frac{u+v}{2} \right)\mathclose{}\cos\mathopen{}\left(\frac{u-v}{2} \right)\mathclose{}.
\end{equation*}
You can derive the other sum-to-product results in a similar way, by adding or subtracting the results involving sines or cosines of sums and differences, and then making the same substitutions.
As far as the last part of your question goes, in general I feel it is very good to worry about the why's and how's as you study mathematics, since it helps you hone your intuition and reinforces concepts as you learn them. This also often reveals ways to derive formulas on the spot as you need them, rather than simply memorising them, as is the case here.
Edit: *The process of rearranging the substitutions and solving for $u$ and $v$ in terms of $A$ and $B$ is as follows. Given the substitutions
\begin{equation*}
u = A + B \tag{2}
\end{equation*}
and
\begin{equation*}
v = A - B \tag{3},
\end{equation*}
we can add equations $(2)$ and $(3)$ to get $u + v = 2A$
so that
\begin{equation*}
A = \frac{u+v}{2}.
\end{equation*}
Instead subtracting $(3)$ from $(2)$ gives $u - v = 2B$, i.e.
\begin{equation*}
B = \frac{u-v}{2}.
\end{equation*}