I am unfamiliar with your formula, but I understand why the answer should be an integer. Consider
$$ det:U(n)\rightarrow S^1$$ the map given by the determinant. Since all the eigenvalues of a unitary matrix lie on the unit circle the map is well defined.
Given a loop in $\gamma:S^1\rightarrow U(n)$, the composition $det\circ \gamma:S^1\rightarrow S^1$ being a map from the circle to the circle has a degree. The degree is a signed count of the inverse image of a ``generic'' point on the circle and measures how many times $det\circ \gamma$ wraps around the circle. See the section of Munkres on the fundamental group of the circle.
Anyways, recall the principal branch of the logarithm is defined on the complement of the negative $x$-axis on the plane. Its restriction to the unit circle is $\mathbf{i}arg$, where $arg$ is the angular argument. Even though $arg$ is not globally defined on the circle its differential is. Note $dlog:TS^1\rightarrow \mathbf{i}\mathbb{R}$ is a purely imaginary one form whose integral over the circle is $2\pi{\mathbf{i}}$.
The pull back $det^*dlog$ to $U(n)$ is a one form. If you pull this back to the loop $\gamma:S^1\rightarrow S^1$ you get
$$\gamma^*det^*dlog=(det\circ \gamma)^*dlog=d(log\circ det \circ \gamma)$$ is a one form on the circle. Change of variables says that $$\int_S^1(det\circ \gamma)^*dlog=deg(det\circ \gamma)2\pi{\mathbf{i}}.$$ Hence if you divide the integral by $2\pi\mathbf{i}$ you get an integer.
The formula you give comes from using the fact that if $M$ is an invertible matrix variable, $$d(log\circ det(M))=Tr(M^{-1}dM).$$ In fact,
$$\frac{1}{2\pi{\bf i}}\int_\gamma Tr(M^{-1}dM)= \frac{1}{2\pi{\bf i}}\int_{S^1}d(log\circ det\circ \gamma)=deg(det\circ \gamma).$$