If A+tB is nilpotent for n+1 distinct values of t, then A and B are nilpotent.
One can do it this way.
Consider the polynomial in the two variables $t, \lambda$ $$ (-1)^{n} \det((A + t B) - \lambda I). $$ Consider this as a polynomial in $t$, of degree $n$, with coefficients in the field of rational functions $\mathbb{R}(\lambda)$. By hypothesis, for $n+1$ distinct values of $t$, it coincides with $\lambda^{n}$, so that one has the equality $$ (-1)^{n} \det((A + t B) - \lambda I) = \lambda^{n} $$ of polynomials in $t, \lambda$. So we can substitute anything in $t$ or $\lambda$, and it will still be an equality. Substitute $t^{-1} \mu$, where $\mu$ is another indeterminate, for $\lambda$, and $t^{-1}$ for $t$ so that we have $$ (-1)^{n} \det((A + t^{-1} B) - t^{-1} \mu I) = (t^{-1} \mu)^{n}. $$ Considering this equality in the field of rational functions, we can multiply by $t^{n}$ and obtain $$ (-1)^{n} \det((t A + B) - \mu I) = \mu^{n}. $$ This is now an identity of polynomials in the indeterminates $t, \mu$.
Finally set $t = 0$ to get that the characteristic polynomial of $B$ is $\mu^{n}$, up to the sign, so that $B$ is also nilpotent.
Note that the basic trick is a common one, and appears for instance in applying Eisenstein's criterion to prove that the $p$-th cyclotomic polynomial has degree $p-1$, when $p$ is prime. That is, one has a prime $p$, and wants to prove that if $x = 1 + t$, then $$\tag{equality} x^{p-1} + x^{p-2} + \dots + x + 1 =\\= t^{p-1} + \binom{p}{p-1} t^{p-2} + \dots + \binom{p}{2} t + \binom{p}{1}. $$ One argues that $$ x^{p} - 1 = (x-1) (x^{p-1} + x^{p-2} + \dots + x + 1), $$ and then substituting $x = 1 + t$ one has \begin{align} x^{p} - 1 &= (1+t)^{p} - 1 \\&= \left( \sum_{i=0}^{p} \binom{p}{i} t^{i} \right) - 1 \\&= t \cdot \sum_{i=1}^{p} \binom{p}{i} t^{i-1} \\&= t \cdot (t^{p-1} + \binom{p}{p-1} t^{p-2} + \dots + \binom{p}{2} t + \binom{p}{1}). \end{align} Now you can divide by $t = x - 1$ and get the required (equality), which is an equality of polynomials, and thus still holds when $t = 0$ (and thus $x = 1$), despite the fact that we have divided by $t$.
This is a a more complete write up using the ideas of @QuangHoang. It can also be viewed as an analytic (instead of algebraic) version of the ideas of @AndreasCaranti
As before, define $f(t)=(A+tB)^n$. This is a matrix valued function, but by examining the individual entries we have $n^2$ real valued functions. We have that $f(t)_{ij}$ is a polynomial of degree at most $n$ which has at least $n+1$ roots, and is therefore identically zero, so $(A+tB)^n=0$ for all $t$. When $t=0$ we have the result that $A$ is nilpotent.
Now, consider $g(t)=((1-t)A+tB)^n=(1-t)^nf(t/(1-t)).$ When $t\neq 1$, we have from the above that $g(t)=0$. However, $g(t)$ is also a polynomial in $t$ in each entry, and hence it is continuous, so $g(1)=B^n=0$.
Once $f(t)=0$ for all $t$, you can forget the original $n+1$ values of $t$ and pick any $n+1$ non-zero values then proceed with your argument.