Use the fact that $S=X_1+X_2 \sim \operatorname{Poisson}(a_1+a_2)$, then compute the conditional PMF:
\begin{align}
P(X_1=x_1|X_1+X_2=n) &= \frac{P(X_1+X_2=n|X_1=x_1) P(X_1=x_1)}{P(X_1+X_2=n)}\\
&=\frac{P(X_2=n-x_1)P(X_1=x_1)}{P(X_1+X_2=n)}\\
&=\frac{\frac{1}{(n-x_1)!}a_2^{n-x_1} e^{}-a_2 \frac{1}{x_1!}a_1^{x_1}e^{-a_1}}{\frac{1}{n!}(a_1+a_2)^n e^{-(a_1+a_2)}}\\
&= \binom{n}{x_1} \frac{a_1^{x_1}a_2^{n-x_1}}{(a_1+a_2)^n}
\end{align}
Having this, you can compute the expected value:
\begin{align}
E(X_1|S=n) &= \sum_{x_1=0}^n x_1 \cdot P(X_1=x_1|X_1+X_2=n)\\
&= \frac{1}{(a_1+a_2)^n} \sum_{x_1=0}^n x_1\cdot \binom{n}{x_1} a_1^{x_1}a_2^{n-x_1} \\
&= \frac{n}{(a_1+a_2)^n} \sum_{x_1=0}^n \binom{n-1}{x_1-1} a_1^{x_1}a_2^{n-x_1} \\
&= \frac{na_1}{(a_1+a_2)^n} \sum_{x_1=0}^n \binom{n-1}{x_1-1} a_1^{x_1-1}a_2^{n-x_1}\\
&= \frac{na_1}{(a_1+a_2)^n} \sum_{j=0}^{n-1} \binom{n-1}{j} a_1^j a_2^{n-1-j}\\
&= \frac{na_1}{(a_1+a_2)^n} (a_1+a_2)^{n-1}\\
&=n \frac{a_1}{a_1+a_2}
\end{align}
Alternatively you can see after the first step that $X_1|S=n \sim \operatorname{Bin}(n,\frac{a_1}{a_1+a_2})$.