TITLE: Trace operators on modules
QUESTION [9 upvotes]: This question is motivated by this other one.
A classical result of linear algebra states what follows

Up to scalar, trace is the only linear operator $\text{M}(n,k) \stackrel{t}{\to} k $ such that $t(AB) = t(BA)$.

So there are two natural generalization of the problem. The first one is in the direction of replacing $k$ with a ring $A$. The other is to ignore the restriction to finite dimensional vector spaces.

Consider a finitely generated module $M$ on a commutative unital ring $A$.
End($M$) has a natural module structure.

A trace operator is a morphism of modules End($ M) \stackrel{tr}{\to} A$ such that $tr(fg)=tr(gf)$.

Tr, the set of trace operators is a submodule of $\text{Hom}_A(\text{End(M)}, A)$. In the special case of vector spaces, its dimension is $1$.

What happens for general rings? Can we recover a partial result? How many trace operators are there?
What should be the trace for a morphism on modules? Sum of eigenvalues looks to me naive.

Examples

In the case of $M = \mathbb{Z}_6, A = \mathbb{Z}$. There are no trace operators.

Attempts

In the case of vector spaces the submodule genetated by $fg-gf$ has codimension 1. What's its codimension in the case of free modules? Maybe this question makes much more sense when $A$ is a PID.

REPLY [4 votes]: As always Michael Shulman has good answers. In here he generalizes and broadens the meaning behind a trace operator saying it is a fixed point operator: it counts fixed points.
Just to give an idea the trace operator have meaning for a dualizable object in a monoidal category. The dualizable objects $X$ are those for which $(-)\otimes X$ has a left and right adjoint.
At page 8 he says without proof that the dualizable objects of $R$-Mod are the finitely generated projective modules, and as such the only modules over which a trace operator can be defined. This explains a posteriori why the example $\mathbb{Z}_6$ does not work.
As such the trace of any endomorphism on a finitely generated projective module becomes as expected the sum of the diagonal of any matrix representing it.
Edit(writing in the night):
Why it is well defined?
In the general world depicted by Shulman the trace of an endomoprhism $f:P\to P$ where $P$ is a projective finitely generated module, is defined as follows:
$$I\to P\otimes P^\star\stackrel{f\otimes id_P}{\longrightarrow}P\otimes P^\star\stackrel{\sim}{\longrightarrow}P^\star\otimes P\stackrel{ev}{\longrightarrow} I,$$ where $I=R$ is the unity of the tensor product.
This definition seem a little bit abstract and not comprehensible. The requirement of $P$ being dualizable comes into play right here: an equivalent characterization of a dualizable object is for the canonical map 
$$P\otimes P^\star\to\hom(P,P)$$ to be an isomorphism.
From this we can rewrite the definition to get a more pleasant one:
$$I\stackrel{\varphi}{\to} \hom(P,P)\stackrel{\hom(P,f)}{\longrightarrow}\hom(P,P)\stackrel{\sim}{\longrightarrow}P^\star\otimes P\stackrel{ev}{\longrightarrow} I,$$
where $\hom(P,f)$ is the usual postcomposition and $\varphi(1)=Id_P$. From this definition it is clear that given an endomorphism $f\in\hom(P,P)$ we can write it as an element of $P\times P^\star$, $f=\sum_{i=1}^n v_i\otimes w^\star_i$, and the trace will be $Tr(f)=\sum_{i=1}^n w^\star_i(v_i)$, independent of the representation chosen.
For one last thing I found this paper, in which Rohrl finds a universal property for the trace and here Beckwith expands it and explains it. I don't like and understand it well so what I say next may not be correct. He seems to have found a generalization of the trace but I am not 100% sure because of the lack of examples and because when he considers the case of modules he looks at what happens on finitely generated prjective. From what I understood the trace becomes a morphism $t:End_R(M)\to T$ with a universal property among those morphisms $t'$ such that for all $\mu\in End(M)$ and for all $\alpha\in Aut(M)$ we have $t'(\mu)=t'(\alpha\mu\alpha^{-1})$, so we have a morphism $\beta:T\to T'$ making the following diagram commutative:
\begin{array}{ccc}
End(M)&\stackrel{t}{\to} & T\\
    &\searrow &\downarrow\\
    & & T'.
\end{array}