[proofplan]
We prove the arbitrary-index isomorphism first, since the finite case is a special case. A homomorphism out of a [direct sum](/page/Direct%20Sum) is determined by its restrictions to the summands, and conversely a family of maps from the summands defines a unique map on the direct sum because every element has finite support. For the second isomorphism, the finiteness of $n$ allows a map into the direct sum to be assembled from its finitely many component maps. Finally, we verify that the constructions are additive, mutually inverse, and natural.
[/proofplan]
[step:Identify a map out of a direct sum with its component restrictions]
Let $I$ be an index set, let $(M_i)_{i \in I}$ be a family of left $R$-modules, and let
\begin{align*}
\iota_i: M_i \to \bigoplus_{j \in I} M_j
\end{align*}
denote the canonical inclusion of the $i$-th summand. Define
\begin{align*}
\Phi: \operatorname{Hom}_R\left(\bigoplus_{i \in I} M_i,N\right) \to \prod_{i \in I}\operatorname{Hom}_R(M_i,N)
\end{align*}
by
\begin{align*}
\Phi(f) = (f \circ \iota_i)_{i \in I}.
\end{align*}
For each $f \in \operatorname{Hom}_R(\bigoplus_{i \in I}M_i,N)$ and each $i \in I$, the composite $f \circ \iota_i$ is $R$-linear, so $\Phi$ is well-defined. If $f,g$ are $R$-linear maps from $\bigoplus_{i \in I} M_i$ to $N$, then for every $i \in I$,
\begin{align*}
\Phi(f+g)_i = (f+g)\circ \iota_i = f\circ \iota_i + g\circ \iota_i = \Phi(f)_i+\Phi(g)_i.
\end{align*}
Thus $\Phi$ is a homomorphism of abelian groups.
[/step]
[step:Reconstruct the map from a family of component maps]
For an element $x \in \bigoplus_{i \in I}M_i$, write $x_i \in M_i$ for its $i$-th component and define its support by
\begin{align*}
\operatorname{supp}(x) := \{i \in I : x_i \neq 0\}.
\end{align*}
By the definition of the direct sum, $\operatorname{supp}(x)$ is finite. Define
\begin{align*}
\Psi: \prod_{i \in I}\operatorname{Hom}_R(M_i,N) \to \operatorname{Hom}_R\left(\bigoplus_{i \in I}M_i,N\right)
\end{align*}
as follows. Given a family $(f_i)_{i \in I}$ with $f_i \in \operatorname{Hom}_R(M_i,N)$, set
\begin{align*}
\Psi((f_i)_{i \in I})(x) := \sum_{i \in \operatorname{supp}(x)} f_i(x_i).
\end{align*}
The sum is finite, so it is defined in the abelian group underlying $N$.
We verify that $\Psi((f_i)_{i \in I})$ is $R$-linear. Let $x,y \in \bigoplus_{i \in I}M_i$ and $r \in R$. Since $\operatorname{supp}(x) \cup \operatorname{supp}(y)$ is finite and contains the support of $x+y$, additivity of each $f_i$ gives
\begin{align*}
\Psi((f_i)_{i \in I})(x+y)=\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(x_i+y_i).
\end{align*}
Hence
\begin{align*}
\Psi((f_i)_{i \in I})(x+y)=\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(x_i)+\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(y_i).
\end{align*}
Terms with zero component contribute $0$, so this equals
\begin{align*}
\Psi((f_i)_{i \in I})(x)+\Psi((f_i)_{i \in I})(y).
\end{align*}
Similarly, because $\operatorname{supp}(rx) \subseteq \operatorname{supp}(x)$ and each $f_i$ is $R$-linear,
\begin{align*}
\Psi((f_i)_{i \in I})(rx)=\sum_{i \in \operatorname{supp}(x)} f_i(rx_i)=\sum_{i \in \operatorname{supp}(x)} r f_i(x_i)=r\Psi((f_i)_{i \in I})(x).
\end{align*}
Therefore $\Psi((f_i)_{i \in I})$ is an $R$-[module homomorphism](/page/Module%20Homomorphism).
The assignment $\Psi$ is additive in the family variable: for families $(f_i)_{i \in I}$ and $(g_i)_{i \in I}$, and for $x \in \bigoplus_{i \in I}M_i$,
\begin{align*}
\Psi((f_i+g_i)_{i \in I})(x)=\sum_{i \in \operatorname{supp}(x)} (f_i+g_i)(x_i).
\end{align*}
Thus
\begin{align*}
\Psi((f_i+g_i)_{i \in I})(x)=\Psi((f_i)_{i \in I})(x)+\Psi((g_i)_{i \in I})(x),
\end{align*}
so $\Psi$ is a homomorphism of abelian groups.
[guided]
The only point that requires care is that $I$ may be infinite. A direct sum is not the full product: an element
\begin{align*}
x \in \bigoplus_{i \in I}M_i
\end{align*}
has components $x_i \in M_i$, but only finitely many of them are nonzero. We record this finite set as
\begin{align*}
\operatorname{supp}(x) := \{i \in I : x_i \neq 0\}.
\end{align*}
This finite-support condition is exactly what makes the formula
\begin{align*}
\Psi((f_i)_{i \in I})(x) := \sum_{i \in \operatorname{supp}(x)} f_i(x_i)
\end{align*}
meaningful: the sum is finite, so it is a legitimate sum in the abelian group underlying $N$.
We now verify $R$-linearity. Let $x,y \in \bigoplus_{i \in I}M_i$ and let $r \in R$. The support of $x+y$ is contained in the finite set $\operatorname{supp}(x)\cup \operatorname{supp}(y)$, so we may sum over that finite set without changing the value, because terms with zero component contribute $0$. Since each
\begin{align*}
f_i: M_i \to N
\end{align*}
is an $R$-[linear map](/page/Linear%20Map), it is additive. Therefore
\begin{align*}
\Psi((f_i)_{i \in I})(x+y)=\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(x_i+y_i).
\end{align*}
Using additivity of $f_i$ for each index in this finite set gives
\begin{align*}
\Psi((f_i)_{i \in I})(x+y)=\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(x_i)+\sum_{i \in \operatorname{supp}(x)\cup \operatorname{supp}(y)} f_i(y_i).
\end{align*}
Removing zero terms from the first and second sums yields
\begin{align*}
\Psi((f_i)_{i \in I})(x+y)=\Psi((f_i)_{i \in I})(x)+\Psi((f_i)_{i \in I})(y).
\end{align*}
For scalar multiplication, $\operatorname{supp}(rx)$ is contained in $\operatorname{supp}(x)$. Since every $f_i$ is $R$-linear,
\begin{align*}
\Psi((f_i)_{i \in I})(rx)=\sum_{i \in \operatorname{supp}(x)} f_i(rx_i).
\end{align*}
Using $R$-linearity of each $f_i$ gives
\begin{align*}
\Psi((f_i)_{i \in I})(rx)=\sum_{i \in \operatorname{supp}(x)} r f_i(x_i).
\end{align*}
Because scalar multiplication in the left $R$-module $N$ distributes over finite sums,
\begin{align*}
\Psi((f_i)_{i \in I})(rx)=r\sum_{i \in \operatorname{supp}(x)} f_i(x_i)=r\Psi((f_i)_{i \in I})(x).
\end{align*}
Hence $\Psi((f_i)_{i \in I})$ is an $R$-module homomorphism.
Finally, $\Psi$ is itself additive as a map between Hom groups. If $(f_i)_{i \in I}$ and $(g_i)_{i \in I}$ are two families of $R$-linear maps, then for every $x \in \bigoplus_{i \in I}M_i$,
\begin{align*}
\Psi((f_i+g_i)_{i \in I})(x)=\sum_{i \in \operatorname{supp}(x)} (f_i+g_i)(x_i).
\end{align*}
Expanding the pointwise sum in the Hom group gives
\begin{align*}
\Psi((f_i+g_i)_{i \in I})(x)=\sum_{i \in \operatorname{supp}(x)} f_i(x_i)+\sum_{i \in \operatorname{supp}(x)} g_i(x_i).
\end{align*}
Thus
\begin{align*}
\Psi((f_i+g_i)_{i \in I})(x)=\Psi((f_i)_{i \in I})(x)+\Psi((g_i)_{i \in I})(x),
\end{align*}
so $\Psi$ is a homomorphism of abelian groups.
[/guided]
[/step]
[step:Show the two constructions out of the direct sum are inverse]
Let $f \in \operatorname{Hom}_R(\bigoplus_{i \in I}M_i,N)$. For $x \in \bigoplus_{i \in I}M_i$, the finite-support decomposition of $x$ is
\begin{align*}
x=\sum_{i \in \operatorname{supp}(x)} \iota_i(x_i).
\end{align*}
Using additivity of $f$ over this finite sum,
\begin{align*}
(\Psi(\Phi(f)))(x)=\sum_{i \in \operatorname{supp}(x)} (f\circ \iota_i)(x_i)=f\left(\sum_{i \in \operatorname{supp}(x)} \iota_i(x_i)\right)=f(x).
\end{align*}
Hence $\Psi\circ \Phi=\operatorname{id}$.
Conversely, let $(f_i)_{i \in I} \in \prod_{i \in I}\operatorname{Hom}_R(M_i,N)$. For $j \in I$ and $m \in M_j$, the element $\iota_j(m)$ has support contained in $\{j\}$ and has $j$-th component $m$. Therefore
\begin{align*}
(\Phi(\Psi((f_i)_{i \in I})))_j(m)=\Psi((f_i)_{i \in I})(\iota_j(m))=f_j(m).
\end{align*}
Since this holds for every $j \in I$ and every $m \in M_j$, we have $\Phi\circ \Psi=\operatorname{id}$. Thus
\begin{align*}
\operatorname{Hom}_R\left(\bigoplus_{i \in I}M_i,N\right) \cong \prod_{i \in I}\operatorname{Hom}_R(M_i,N)
\end{align*}
as abelian groups. Taking $I=\{1,\ldots,n\}$ gives the first finite isomorphism.
[/step]
[step:Identify a map into a finite direct sum with its component projections]
Now assume $I=\{1,\ldots,n\}$. For each $i \in \{1,\ldots,n\}$, let
\begin{align*}
\pi_i: \bigoplus_{j=1}^n M_j \to M_i
\end{align*}
be the canonical projection onto the $i$-th summand. Define
\begin{align*}
\Theta: \operatorname{Hom}_R\left(N,\bigoplus_{i=1}^n M_i\right) \to \prod_{i=1}^n \operatorname{Hom}_R(N,M_i)
\end{align*}
by
\begin{align*}
\Theta(g)=(\pi_i\circ g)_{i=1}^n.
\end{align*}
Each composite $\pi_i\circ g$ is $R$-linear, so $\Theta$ is well-defined. Since composition with each projection preserves pointwise addition of homomorphisms, $\Theta$ is a homomorphism of abelian groups.
Define
\begin{align*}
\Lambda: \prod_{i=1}^n \operatorname{Hom}_R(N,M_i) \to \operatorname{Hom}_R\left(N,\bigoplus_{i=1}^n M_i\right)
\end{align*}
as follows. Given $(g_i)_{i=1}^n$ with $g_i \in \operatorname{Hom}_R(N,M_i)$, let $\Lambda((g_i)_{i=1}^n)$ be the map
\begin{align*}
\Lambda((g_i)_{i=1}^n): N \to \bigoplus_{i=1}^n M_i
\end{align*}
defined by
\begin{align*}
\Lambda((g_i)_{i=1}^n)(y)=(g_1(y),\ldots,g_n(y)).
\end{align*}
Because the tuple has only finitely many components, it is an element of the finite direct sum. Additivity and $R$-linearity of the coordinate maps $g_i$ imply additivity and $R$-linearity of $\Lambda((g_i)_{i=1}^n)$. Pointwise addition in each coordinate also shows that $\Lambda$ is a homomorphism of abelian groups.
[/step]
[step:Show the two constructions into the finite direct sum are inverse]
Let $g \in \operatorname{Hom}_R(N,\bigoplus_{i=1}^n M_i)$ and let $y \in N$. The element $g(y)$ is the finite tuple of its components:
\begin{align*}
g(y)=((\pi_1\circ g)(y),\ldots,(\pi_n\circ g)(y)).
\end{align*}
Therefore
\begin{align*}
(\Lambda(\Theta(g)))(y)=g(y),
\end{align*}
so $\Lambda\circ\Theta=\operatorname{id}$.
Conversely, let $(g_i)_{i=1}^n \in \prod_{i=1}^n\operatorname{Hom}_R(N,M_i)$. For each $j \in \{1,\ldots,n\}$ and each $y \in N$,
\begin{align*}
(\Theta(\Lambda((g_i)_{i=1}^n)))_j(y)=\pi_j(g_1(y),\ldots,g_n(y))=g_j(y).
\end{align*}
Thus $\Theta\circ\Lambda=\operatorname{id}$. Hence
\begin{align*}
\operatorname{Hom}_R\left(N,\bigoplus_{i=1}^n M_i\right) \cong \prod_{i=1}^n\operatorname{Hom}_R(N,M_i)
\end{align*}
as abelian groups.
[/step]
[step:Verify naturality of the isomorphisms]
The first isomorphism is natural in the target module $N$ because it is defined by precomposition with the canonical inclusions $\iota_i$ and its inverse is defined by the finite-support summation formula. Explicitly, if
\begin{align*}
h: N \to N'
\end{align*}
is an $R$-module homomorphism, then for every $f: \bigoplus_{i \in I}M_i \to N$ and every $i \in I$,
\begin{align*}
\Phi(h\circ f)_i=h\circ f\circ \iota_i=h\circ \Phi(f)_i.
\end{align*}
Thus applying $h$ after the reconstructed map agrees componentwise with applying $h$ to each component map.
We also verify naturality in the summand variables. Let $(M_i')_{i \in I}$ be another family of left $R$-modules, and for each $i \in I$ let
\begin{align*}
a_i: M_i' \to M_i
\end{align*}
be an $R$-module homomorphism. Let
\begin{align*}
a: \bigoplus_{i \in I} M_i' \to \bigoplus_{i \in I} M_i
\end{align*}
be the induced direct-sum homomorphism, so that $a\circ\iota_i'=\iota_i\circ a_i$ for every $i \in I$, where $\iota_i':M_i'\to\bigoplus_{j\in I}M_j'$ is the canonical inclusion. For every $f: \bigoplus_{i \in I}M_i \to N$ and every $i \in I$,
\begin{align*}
\Phi(f\circ a)_i=f\circ a\circ\iota_i'=f\circ\iota_i\circ a_i=\Phi(f)_i\circ a_i.
\end{align*}
This is exactly the componentwise commutativity of the naturality square in the variables $(M_i)_{i \in I}$.
The second isomorphism is natural in the source module $N$ because it is defined by postcomposition with the canonical projections $\pi_i$ and its inverse is the coordinatewise tuple map. Explicitly, if
\begin{align*}
k: N' \to N
\end{align*}
is an $R$-module homomorphism, then for every $g: N \to \bigoplus_{i=1}^n M_i$ and every $i \in \{1,\ldots,n\}$,
\begin{align*}
\Theta(g\circ k)_i=\pi_i\circ g\circ k=\Theta(g)_i\circ k.
\end{align*}
For naturality in the finite family of target summands, let $b_i:M_i\to M_i'$ be $R$-module homomorphisms and let $b:\bigoplus_{i=1}^n M_i\to\bigoplus_{i=1}^n M_i'$ be the induced direct-sum homomorphism. For every $g:N\to\bigoplus_{i=1}^n M_i$ and every $j\in\{1,\ldots,n\}$,
\begin{align*}
\Theta(b\circ g)_j=\pi_j'\circ b\circ g=b_j\circ\pi_j\circ g=b_j\circ\Theta(g)_j,
\end{align*}
where $\pi_j':\bigoplus_{i=1}^n M_i'\to M_j'$ is the canonical projection. Therefore both displayed isomorphisms are natural, and the proof is complete.
[/step]