[proofplan]
We first verify that $I+J$ is an ideal. To prove nilpotence, we use the lower central series and track how many entries in an iterated commutator come from $I$ and how many come from $J$. A commutator involving $r$ entries from $I$ and $s$ entries from $J$ lies in $\gamma_r(I)$ if $r>0$ and in $\gamma_s(J)$ if $s>0$. Since $I$ and $J$ are nilpotent, every sufficiently long commutator in $I+J$ must have too many entries from at least one of the two ideals, and therefore vanishes.
[/proofplan]
[step:Verify that the sum is an ideal]
Let $K:=I+J\subseteq \mathfrak g$ denote the vector subspace sum. Since $I$ and $J$ are vector subspaces of $\mathfrak g$, $K$ is a vector subspace of $\mathfrak g$.
We prove that $K\trianglelefteq \mathfrak g$. Let $x\in \mathfrak g$ and let $y\in K$. By definition of $K$, there exist $a\in I$ and $b\in J$ such that $y=a+b$. Using bilinearity of the Lie bracket,
\begin{align*}
[x,y]=[x,a+b]=[x,a]+[x,b].
\end{align*}
Because $I\trianglelefteq \mathfrak g$, we have $[x,a]\in I$. Because $J\trianglelefteq \mathfrak g$, we have $[x,b]\in J$. Hence $[x,y]\in I+J=K$. Therefore $K$ is an ideal of $\mathfrak g$.
[/step]
[step:Introduce the lower central series and choose nilpotence lengths]
For any Lie algebra $L$, define its lower central series $\gamma_m(L)$ by
\begin{align*}
\gamma_1(L)&:=L,\\
\gamma_{m+1}(L)&:=[L,\gamma_m(L)]\quad\text{for }m\geq 1.
\end{align*}
Here $[A,B]$ denotes the $k$-linear span of all brackets $[a,b]$ with $a\in A$ and $b\in B$.
Since $I$ is nilpotent, there exists an integer $p\geq 1$ such that
\begin{align*}
\gamma_{p+1}(I)=0.
\end{align*}
Since $J$ is nilpotent, there exists an integer $q\geq 1$ such that
\begin{align*}
\gamma_{q+1}(J)=0.
\end{align*}
We will prove that
\begin{align*}
\gamma_{p+q+1}(K)=0.
\end{align*}
This will show that $K=I+J$ is nilpotent.
[guided]
The lower central series measures the length of iterated brackets. Saying that $I$ is nilpotent means that all sufficiently long iterated brackets of elements of $I$ vanish. We record this by choosing $p\geq 1$ with $\gamma_{p+1}(I)=0$. Likewise, nilpotence of $J$ gives $q\geq 1$ with $\gamma_{q+1}(J)=0$.
The target is to show that sufficiently long iterated brackets in $K=I+J$ vanish. Since each element of $K$ is a sum of one element from $I$ and one element from $J$, multilinearity reduces every long commutator in $K$ to a sum of commutators whose entries are individually chosen from either $I$ or $J$. If a commutator has more than $p$ entries from $I$, it should vanish because it lies in $\gamma_{p+1}(I)$. If it has more than $q$ entries from $J$, it should vanish because it lies in $\gamma_{q+1}(J)$. A commutator of length $p+q+1$ must have one of these two properties.
[/guided]
[/step]
[step:Track mixed commutators by the number of entries from each ideal]
For integers $r,s\geq 0$ with $r+s\geq 1$, let $C_{r,s}$ denote the $k$-linear span of all left-normed commutators
\begin{align*}
[x_1,[x_2,\dots,[x_{r+s-1},x_{r+s}]\dots]]
\end{align*}
in which exactly $r$ of the entries $x_1,\dots,x_{r+s}$ lie in $I$ and exactly $s$ lie in $J$.
We claim that, for every $r,s\geq 0$ with $r+s\geq 1$,
\begin{align*}
r>0 &\implies C_{r,s}\subseteq \gamma_r(I),\\
s>0 &\implies C_{r,s}\subseteq \gamma_s(J).
\end{align*}
[claim:Mixed commutators lie in the corresponding lower central terms]
For every $r,s\geq 0$ with $r+s\geq 1$, if $r>0$ then $C_{r,s}\subseteq \gamma_r(I)$, and if $s>0$ then $C_{r,s}\subseteq \gamma_s(J)$.
[/claim]
[proof]
We prove the assertion by induction on $m:=r+s$.
For $m=1$, either $(r,s)=(1,0)$ or $(r,s)=(0,1)$. In the first case, $C_{1,0}=I=\gamma_1(I)$. In the second case, $C_{0,1}=J=\gamma_1(J)$. Thus the assertion holds.
Assume the assertion holds for all pairs whose sum is $m-1$, and fix $r,s\geq 0$ with $r+s=m$. A spanning element of $C_{r,s}$ has the form
\begin{align*}
[x,y],
\end{align*}
where $x\in I$ or $x\in J$, and $y$ is a left-normed commutator of length $m-1$ containing the remaining entries.
Suppose first that $r>0$. If $x\in I$, then $y\in C_{r-1,s}$, and by induction, if $r-1>0$ then $y\in\gamma_{r-1}(I)$; if $r-1=0$, then $y$ is a commutator of entries from $J$, hence $y\in J$. In the first subcase,
\begin{align*}
[x,y]\in[I,\gamma_{r-1}(I)]=\gamma_r(I).
\end{align*}
In the second subcase, $x\in I$ and $y\in J$, so $[x,y]\in I$ because $I\trianglelefteq\mathfrak g$; since $r=1$, this gives $[x,y]\in\gamma_1(I)=I$.
If instead $x\in J$, then the remaining commutator $y$ has $r$ entries from $I$ and $s-1$ entries from $J$. By induction, $y\in\gamma_r(I)$. Since $I\trianglelefteq\mathfrak g$, each lower central term $\gamma_r(I)$ is an ideal of $\mathfrak g$: this follows by induction from the Jacobi identity and the fact that $I$ is an ideal. Hence
\begin{align*}
[x,y]\in[\mathfrak g,\gamma_r(I)]\subseteq\gamma_r(I).
\end{align*}
Thus $C_{r,s}\subseteq\gamma_r(I)$ whenever $r>0$.
We now prove the corresponding assertion for $J$. Suppose that $s>0$. If $x\in J$, then $y\in C_{r,s-1}$. If $s-1>0$, the induction hypothesis gives $y\in\gamma_{s-1}(J)$, and hence
\begin{align*}
[x,y]\in[J,\gamma_{s-1}(J)]=\gamma_s(J).
\end{align*}
If $s-1=0$, then $y$ is a commutator of entries from $I$, so $y\in I$; because $J\trianglelefteq\mathfrak g$, we have $[x,y]\in J=\gamma_1(J)$, which is the desired conclusion for $s=1$.
If instead $x\in I$, then $y$ has $s$ entries from $J$ and $r-1$ entries from $I$. By induction, $y\in\gamma_s(J)$. Since $J\trianglelefteq\mathfrak g$, the same Jacobi-identity induction used above shows that every lower central term $\gamma_s(J)$ is an ideal of $\mathfrak g$. Therefore
\begin{align*}
[x,y]\in[\mathfrak g,\gamma_s(J)]\subseteq\gamma_s(J).
\end{align*}
Thus $C_{r,s}\subseteq\gamma_s(J)$ whenever $s>0$.
[/proof]
[guided]
The point of this step is to make precise the bookkeeping behind mixed commutators. A commutator with $r$ entries from $I$ should behave like an $r$-fold commutator inside $I$, even if some entries from $J$ are interspersed. This works because $I$ is not merely a subalgebra: it is an ideal, so bracketing by elements of $\mathfrak g$ keeps us inside the relevant ideal terms. The same applies to $J$.
For $r,s\geq 0$ with $r+s\geq 1$, define $C_{r,s}$ to be the $k$-linear span of all left-normed commutators
\begin{align*}
[x_1,[x_2,\dots,[x_{r+s-1},x_{r+s}]\dots]]
\end{align*}
with exactly $r$ entries from $I$ and exactly $s$ entries from $J$. We prove that
\begin{align*}
r>0 &\implies C_{r,s}\subseteq \gamma_r(I),\\
s>0 &\implies C_{r,s}\subseteq \gamma_s(J).
\end{align*}
We argue by induction on the total length $m=r+s$. When $m=1$, the only possibilities are $C_{1,0}=I=\gamma_1(I)$ and $C_{0,1}=J=\gamma_1(J)$, so the assertion is immediate from the definition of the lower central series.
Assume the assertion has been proved for commutators of length $m-1$, and consider a spanning left-normed commutator of length $m$:
\begin{align*}
[x,y],
\end{align*}
where $x$ is the first entry and $y$ is the left-normed commutator formed from the remaining $m-1$ entries.
We first track membership in the lower central series of $I$. Suppose $r>0$. If $x\in I$, then $y$ contains $r-1$ entries from $I$ and $s$ entries from $J$. When $r-1>0$, the induction hypothesis gives $y\in\gamma_{r-1}(I)$, hence
\begin{align*}
[x,y]\in[I,\gamma_{r-1}(I)]=\gamma_r(I).
\end{align*}
When $r-1=0$, the element $y$ is built only from entries of $J$, so $y\in J$. Since $I$ is an ideal of $\mathfrak g$, $[x,y]\in I=\gamma_1(I)$, which is exactly the desired conclusion for $r=1$.
If $x\in J$, then $y$ still contains all $r$ entries from $I$. By induction, $y\in\gamma_r(I)$. We need to know that bracketing $y$ with $x\in J\subseteq\mathfrak g$ keeps us in $\gamma_r(I)$. This follows because every $\gamma_r(I)$ is an ideal of $\mathfrak g$. Indeed, $\gamma_1(I)=I$ is an ideal by hypothesis; if $\gamma_r(I)$ is an ideal, then the Jacobi identity gives stability of $[I,\gamma_r(I)]$ under bracketing with elements of $\mathfrak g$, so $\gamma_{r+1}(I)$ is again an ideal. Therefore
\begin{align*}
[x,y]\in[\mathfrak g,\gamma_r(I)]\subseteq\gamma_r(I).
\end{align*}
This proves $C_{r,s}\subseteq\gamma_r(I)$ for $r>0$. Interchanging the roles of $I$ and $J$ gives the second inclusion: if $s>0$, then $C_{r,s}\subseteq\gamma_s(J)$.
[/guided]
[/step]
[step:Show that all sufficiently long commutators in $I+J$ vanish]
We prove that every left-normed commutator of length $p+q+1$ with entries in $K$ is zero. Let $y_1,\dots,y_{p+q+1}\in K$. For each index $\ell\in\{1,\dots,p+q+1\}$, choose $a_\ell\in I$ and $b_\ell\in J$ such that
\begin{align*}
y_\ell=a_\ell+b_\ell.
\end{align*}
By multilinearity of the Lie bracket, the commutator
\begin{align*}
[y_1,[y_2,\dots,[y_{p+q},y_{p+q+1}]\dots]]
\end{align*}
is a finite sum of left-normed commutators in which each entry is one of the corresponding $a_\ell\in I$ or $b_\ell\in J$.
Consider one summand. Suppose it contains $r$ entries from $I$ and $s$ entries from $J$. Then
\begin{align*}
r+s=p+q+1.
\end{align*}
If $r\geq p+1$, then the previous step gives that the summand lies in $\gamma_r(I)\subseteq\gamma_{p+1}(I)=0$. If $r\leq p$, then
\begin{align*}
s=p+q+1-r\geq q+1,
\end{align*}
so the previous step gives that the summand lies in $\gamma_s(J)\subseteq\gamma_{q+1}(J)=0$. Thus every summand is zero, and hence the original commutator is zero.
By induction on $m\geq 1$ from the definition $\gamma_{m+1}(K)=[K,\gamma_m(K)]$, the subspace $\gamma_m(K)$ is the $k$-linear span of all left-normed commutators of length $m$ with entries in $K$. Therefore the vanishing of every left-normed commutator of length $p+q+1$ in $K$ gives
\begin{align*}
\gamma_{p+q+1}(K)=0.
\end{align*}
Thus $K=I+J$ is nilpotent.
[guided]
Now we use the bookkeeping estimate to finish the nilpotence argument. Take arbitrary elements
$y_1,\dots,y_{p+q+1}\in K$. Since $K=I+J$, for each $\ell\in\{1,\dots,p+q+1\}$ we can write
\begin{align*}
y_\ell=a_\ell+b_\ell
\end{align*}
with $a_\ell\in I$ and $b_\ell\in J$.
Consider the left-normed commutator
\begin{align*}
[y_1,[y_2,\dots,[y_{p+q},y_{p+q+1}]\dots]].
\end{align*}
The Lie bracket is bilinear in each entry, so expanding each $y_\ell=a_\ell+b_\ell$ expresses this commutator as a finite sum of left-normed commutators whose entries are individually chosen from $I$ or $J$.
Fix one such summand. Let $r$ be the number of its entries belonging to $I$, and let $s$ be the number of its entries belonging to $J$. Then
\begin{align*}
r+s=p+q+1.
\end{align*}
There are two possibilities. If $r\geq p+1$, then $r>0$, and the mixed-commutator claim proved above states that every commutator with $r$ entries from $I$ and $s$ entries from $J$ belongs to $\gamma_r(I)$. Hence this summand belongs to $\gamma_r(I)$. Since the lower central series is decreasing and $\gamma_{p+1}(I)=0$, we have
\begin{align*}
\gamma_r(I)\subseteq\gamma_{p+1}(I)=0,
\end{align*}
so this summand is zero.
If $r\leq p$, then the total length forces
\begin{align*}
s=p+q+1-r\geq q+1.
\end{align*}
In particular $s>0$, and the mixed-commutator claim states that every commutator with $r$ entries from $I$ and $s$ entries from $J$ belongs to $\gamma_s(J)$. Hence this summand belongs to $\gamma_s(J)$. Since $\gamma_{q+1}(J)=0$, we get
\begin{align*}
\gamma_s(J)\subseteq\gamma_{q+1}(J)=0.
\end{align*}
Thus this summand is also zero.
Every summand in the multilinear expansion is zero, so the original commutator is zero. Since the entries $y_1,\dots,y_{p+q+1}$ were arbitrary elements of $K$, all left-normed commutators of length $p+q+1$ in $K$ vanish. The connection with the lower central series is the following standard induction: $\gamma_1(K)=K$ is the span of all left-normed commutators of length $1$, and if $\gamma_m(K)$ is the span of all left-normed commutators of length $m$, then $\gamma_{m+1}(K)=[K,\gamma_m(K)]$ is the span of all left-normed commutators of length $m+1$. Therefore
\begin{align*}
\gamma_{p+q+1}(K)=0.
\end{align*}
Therefore $K=I+J$ is a nilpotent Lie algebra.
[/guided]
[/step]
[step:Conclude the theorem]
We have shown that $K=I+J$ is an ideal of $\mathfrak g$ and that $\gamma_{p+q+1}(K)=0$. Hence $I+J$ is a nilpotent ideal of $\mathfrak g$, as required.
[/step]