Let $a_1, a_2, \ldots, a_{2017}$ be the 2017 distinct complex numbers which satisfy $a_i^{2017} = a_i + 1$ for $i = 1, 2, \ldots, 2017$. Compute $$\sum_{i=1}^{2017} \frac{a_i}{a_i^2 + 1}.$$

Let's think step by step and output the final answer within \boxed{}.
user