This is not an answer, but it's too long for comments.

First of all it would be really helpful if you provided some background. Is this a numerical problem or algebraic problem?

Two ideas come to mind.

First, let's say that $A$ is regular, then
$$
(A+\lambda \imath B)^{-1} = (A(I + \lambda \imath A^{-1}B)^{-1} = (I + \lambda \imath A^{-1}B)^{-1}A^{-1}.
$$

Now if all eigenvalues of $\lambda A^{-1}B$ are smaller than $1$, the converges and you can compute the inverse as
$$
(I + \lambda \imath A^{-1}B)^{-1} = \sum_{k=0}^\infty (\lambda\imath)^k (A^{-1}B)^k.
$$
If $A^{-1}B$ is nilpotent, then your inverse is just a matrix polynomial in $\lambda$. Otherwise this can be used at least for approximation of the inverse.

Second idea.

If your matrices are not too large you can try to work with analytical inversion which works also for matrices of polynomials. I.e. you can write down the using subdeterminants of $A+ \lambda\imath B$ treating $\lambda$ as a variable.

OK. So the problem seems to be:

Compute (numerically) the sum of elements of the inverse of $A+\lambda\imath B$ for real matrices $A,B$, where $A$ is diagonal, $B$ is symmetric and $\lambda$ is a real parameter. The matrices are of order $1000 \times 1000$.

As was explained in the answer to another problem of OP, the sum of elements of the inverse can be obtained as follows. Let $e$ denote the vector of all ones. Then the sought sum equals to the scalar product of $e$ and the solution $x$ of $(A+\lambda\imath B)x = e$. Without any further information it seems that the best possible course is to rewrite the equation as
$$
\Bigl(\frac{-\imath }{\lambda} A + B \Bigr)x = \frac{-\imath }{\lambda}e
$$
and google for diagonal updates for iterative methods (e.g. Krylov subspaces method) as Federico Poloni suggested in a comment.