How do we count the number of ways a loop can go around a torus? As Cumrun Vafa explains in this video, he was able to calculate the number of micro-states for a black hole by counting the number of ways a loop can go around a torus. Obviously, there are infinite ways to do it. I assume that he counted them up to some transformations.
Am I right? What are those transformations?
 A: As Koschi mentioned in their comment, this is indeed calculating the fundamental group of the torus (also called the first homotopy group)
\begin{equation*}
\pi_1(T^2) = \{\gamma: S^1 \rightarrow T^2 \}/\sim,
\end{equation*}
where loops are equivalent if there exists a homotopy between them.
I think this is where your confusion lies as the same words are used in a different context.
In this case, 2 loops $f,g: S^1 \rightarrow T^2$ are homotopy equivalent if there exits a continuous function
$H: [0,1] \times S^1 \rightarrow T^2$ such that
\begin{align*}
H(0,x) &= f(x)\\
H(1,x) &= g(x).
\end{align*}
I recommend this Wikipedia entry for a better explanation.
Finally, for the actual answer to your question this Math Stack Exchange entry has you covered.
In broad strokes though, the fundamental group of the 2-torus is the free product of the fundamental groups of 2 copies of $S^1$ because of the Seifert-Van Kampen theorem. And the fundamental group of the circle can be thought of as the equivalence class of maps from the circle to itself.
What does such an equivalence class look like?
Well you can wrap the circle around itself once, twice, ... $n$ times, and you can wrap it minus once too, minus twice, etc.
Further we see that two loops that don't have the same winding number cannot be continuously deformed into one another without singularities, motivating the result that the winding number represents classes of loops: $\pi_1(S^1) = \mathbb{Z}$.
Finally, we have
\begin{equation}
\pi_1(T^2) = \mathbb{Z}\times\mathbb{Z}.
\end{equation}
