[guided]We choose a basis because trace is computed from the diagonal of a matrix representative. Let $n := \dim_k V$, and choose an ordered basis $\mathcal{E} = (e_1,\dots,e_n)$ of $V$. If $n = 0$, then $\mathcal{E}$ is empty and every finite sum over $\{1,\dots,n\}$ is an empty sum, equal to $0$.
Define $A = (a_{ij})_{1 \le i,j \le n} \in k^{n \times n}$ to be the matrix of the linear map $S: V \to V$ in the basis $\mathcal{E}$. This means that, for each basis vector $e_j$,
\begin{align*}
S(e_j) = \sum_{i=1}^{n} a_{ij} e_i.
\end{align*}
Define $B = (b_{ij})_{1 \le i,j \le n} \in k^{n \times n}$ to be the matrix of the linear map $T: V \to V$ in the same basis. Thus, for each $j \in \{1,\dots,n\}$,
\begin{align*}
T(e_j) = \sum_{i=1}^{n} b_{ij} e_i.
\end{align*}
The reason for using the same basis for both maps is that composition of linear maps is then represented by matrix multiplication. Let $v \in k^n$ be an arbitrary coordinate vector. In this basis, $S \circ T$ is represented by $AB$, because applying $T$ first gives the coordinate vector $Bv$, and applying $S$ next gives $A(Bv) = (AB)v$. Similarly, $T \circ S$ is represented by $BA$.
The commutator is defined by
\begin{align*}
[S,T] := S \circ T - T \circ S.
\end{align*}
Therefore the matrix of $[S,T]$ in the basis $\mathcal{E}$ is
\begin{align*}
C := AB - BA.
\end{align*}
Finally, the trace of a linear map on a finite-dimensional [vector space](/page/Vector%20Space) is the trace of any matrix representing it in an ordered basis. Hence
\begin{align*}
\operatorname{tr}([S,T]) = \operatorname{tr}(C).
\end{align*}[/guided]