We consider a rank $n$ holomorphic vector bundle $E$ over a Riemann sphere $\mathbb{P}^1$, and let $\nabla$ be a meromorphic connection on $E$ with poles at $a_1,...,a_m\in\mathbb{P}^1$, where each pole $a_i$ is of $k_i-$order.
Now, in some local trivialization of $E$ near a pole $a_i$, namely $$\phi_i: E_{D_i}\longrightarrow D_i\times\mathbb{C}^n$$ where $D_i$ is an open coordinate neighborhood of $a_i$ such that the coordinate of $a_i$ is $0$, then we can write down $\nabla$ in this local trivialization as the Laurent series: $$\nabla=d-\left(\frac{^i\!A_{k_i}}{z^{k_i}}+\cdots +\frac{^i\!A_1}{z}+\cdots\right)dz$$ where these $^i\!A_j$ are constant matrices.
Now, we define the residue of $\nabla$ at the pole $a_i$ as $$\mathrm{Res}_{a_i}(\nabla):=\mathrm{Tr}(\,^i\!A_1)$$ It is not hard to prove this definition is independent of the choice of the local trivialization, since different local trivialization yields a new expression of $\nabla$ which differed by a gauge transformation, and that will not change the trace of $^i\!A_1$.
We define the residues of $\nabla$ as the sum of all residue at each $a_i$: $$\mathrm{Res}(\nabla):=\sum_{i=1}^m\mathrm{Tr}\left(\,^i\!A_1\right)$$
What can we tell about these residues? I have a bould guess, that is $$\mathrm{Res}(\nabla)=\deg E$$ But I don't know if it is right.
After a long while thinking, I think I know how to prove that. To be simplified, we can start from the case of rank 1, i.e, we consider a meromorphic connection $\nabla$ on a line bundle $L$ over $\mathbb{P^1}$.
The divisor of the poles of $\nabla$ can be denoted by $$D=k_1\cdot a_1+\cdots k_m\cdot a_m$$ and use $\Omega^1_{D}(\mathbb{P}^1)$ represents for the sheaf of meromorphic 1-forms with poles on $D$.
Recall that, a mermorphic connection is a sheaf morphism: $$\nabla:L\longrightarrow L\otimes\Omega^1_D\left(\mathbb{P}^1\right)$$ satisfying the Leibniz rule. Let $$U_1=\left\{[x,y]\in\mathbb{P}^1|x\neq0\right\}\quad U_2=\left\{[x,y]\in\mathbb{P}^1|y\neq0\right\}$$ be the standard open cover on $\mathbb{P^1}$, the transition function of $L$ is given by $$g_{12}[x,y]=\left(\frac{x}{y}\right)^{\deg L}: U_1\cap U_2\longrightarrow\mathbb{C}^*$$ WLOG, we can assume all poles of $\nabla$ lye in $U_1$, i.e, $a_1,..,a_m\in U_1$.
Now, we choose a nowhere vanishing section of $L$ on $U_1$, namely $\sigma_1\in\Gamma(U_1;L)$, and $\sigma_2$ a section of $L$ on $U_2$ determined by $$\sigma_2=g_{12}\sigma_1: U_2\longrightarrow L\qquad\qquad (\mathbf{*})$$ hence no hard to see $\sigma_2$ is also nowhere vanishing on $U_2$, hence we can find two forms $\eta_1,\eta_2\in\Omega^1_D$ such that $$\nabla\sigma_1=\eta_1\otimes\sigma_1\quad\nabla\sigma_2=\eta_2\otimes\sigma_2$$ Hence by $(\mathbf{*})$, we have $$\frac{dg_{12}}{g_{12}}=\eta_2-\eta_1$$ As we assuming $U_1$ containing all poles of $\nabla$, hence $\eta_2$ is in fact a holomorphic 1-form, and $\eta_1$ has the same residue as $\nabla$, i.e, $\mathrm{Res}\eta_1=\mathrm{Res}\nabla$ !!!!
Now, we use the coordinate $z=x/y$ on $U_1\cap U_2$, and consider the equality $$\eta_1=\eta_2-\frac{\deg L}{z}$$ and taking residue on both sides yields: $$\mathrm{Res}(\nabla)=\mathrm{Res}(\eta_1)=-\deg L\qquad\blacksquare$$
This result can be generalized to higher dimensional complex manifolds, but we need to make a restrain that $\nabla$ is flat, the proof is rather technique, for details can be found in this paper: https://arxiv.org/pdf/2206.09745.pdf