I will suppose that $i=n$ if $X_0$ is not greater than any of the $X_k.$
Then
$$
\mathrm E(i)
= \mathrm P(i \geq 1) + \mathrm P(i \geq 2) + \cdots + \mathrm P(i \geq n).
$$
Obviously $\mathrm P(i \geq 1)=1$, but $i \geq 2$ only if $X_0$ is the greater of the values $X_0,X_1$; either of these is equally likely to be greater,
so $\mathrm P(i \geq 2)=\frac12.$
Similarly, $i \geq 3$ only if $X_0$ is the greatest of the three values
$X_0,X_1,X_2$; any of these is equally likely to be the greatest in the list,
so $\mathrm P(i \geq 3)=\frac13.$
In general, for $k \leq n,$ $i \geq k$ only if $X_0$ is the greatest of the $k$ values $X_0,X_1,\ldots,X_k$; any of these is equally likely to be the greatest in the list,
so $\mathrm P(i \geq k)=\frac1k.$
In summary, $\mathrm E(i) = 1 + \frac12 + \frac13 + \ldots + \frac1n.$
Now let $n \to \infty.$
Addendum
To prove that $\mathrm E(i)
= \mathrm P(i \geq 1) + \mathrm P(i \geq 2) + \cdots + \mathrm P(i \geq n),$
one possible approach is to observe that
$$ \mathrm P(i \geq k) =
\mathrm P(i = 1) + \mathrm P(i = 2) + \cdots + \mathrm P(i = k), $$
break up all the terms of the sum this way,
and recombine them to get
$$\mathrm P(i = 1) + 2\mathrm P(i = 2) + \cdots + n\mathrm P(i = n).$$
Another way is to define $Z_k = 1$ if $i \geq k,$ $Z_k = 0$ otherwise, that is, $Z_k$ is an indicator variable saying whether we compared $X_0$ to $X_k$
(as opposed to stopping earlier).
But since $i$ is just the number of comparisons we made,
$i = Z_1 + Z_2 + \cdots + Z_n$ (adding $1$ for each $X_k$ that actually got compared and $0$ for each of the others),
and by linearity of expectation,
$$\mathrm E(i) = \mathrm E(Z_1) + \mathrm E(Z_2) + \cdots + \mathrm E(Z_n).$$
But $Z_k = 1$ if and only if $i \geq k,$ so
$\mathrm E(Z_k) = \mathrm P(i \geq k),$ and the conclusion follows immediately.