We take all possible unordered pairs by choosing 2 out of the n people: $ \binom{n}{2} $
$P_i$‘s birthday can be any day: $ \frac{365}{365} $
$P_j$‘s birthday must be the same day: $ \frac{1}{365} $
$ \mathbb{E}(X) = \binom{n}{2} \cdot \frac{1}{365} $