Let $A$ be a Noetherian commutative ring and Let $A\rightarrow B$ be a finite flat homomorphism of rings. We can thus form the so called "trace" $\mathrm{Tr_{B/A}}:B\rightarrow A$, which is a homomorphism of $A$ - modules defined as follows:
Every $b\in B$ acts on $B$ (when viewed as an $A$ - module) by multiplication. Since $B$ is finite flat over $A$ and $A$ is Noetherian, $B$ is a locally free $A$ - module and hence multiplication by $b$ is given locally (on a principal open subset $\mathrm{Spec}(A_s)\subseteq \mathrm{Spec}(A),s\in A$ and under some isomorphism $B_s\cong A_s^n$) by multiplication by a matrix. We define $\mathrm{Tr_{B/A}}(b)$ to be the trace of this matrix. Since the trace of a matrix is independent of the choice of basis this homomorphism of $A$ - modules glues nicely and is well defined.
In the case $A\rightarrow B$ is finite etale one can even show that this morphism is nondegenerate, i.e.: Induces an isomorphism $B\overset{\sim}\rightarrow \mathrm{Hom}_A(B,A)$ by adjunction (this is a well known claim of Galois theory in the case where $A\rightarrow B$ is a finite seperable field extension).
My (rather ill-formulated) questions are the following:
1) Are there any other algebraic/geometric constructions I should think of as similar to this one?
2) Is there a deeper reason for the existence of such trace morphisms (for example some categorical phenomena that this is a special case of)? what's so special about finite flat homomorphisms that makes this happen? It seems to me pretty mysterious that such a homomorphism even exists, and I do not seem to completely grasp it's geometric meaning.
3) What is the geometric intuition behind the cannonical isomorphism of $A$ - modules $B\overset{\sim}\rightarrow \mathrm{Hom}_A(B,A)$ in case $A\rightarrow B$ is finite etale?
[edit] Let me try to be abit more specific about what bothers me:
Given a ring homomorphism $\phi :A\rightarrow B$ there's an obvious adjunction: $\mathrm{Forget}:\mathsf Mod_B \substack{\longrightarrow\\\perp \\\longleftarrow \\}\mathsf Mod_A:\mathrm{Hom}_A(B,-)$ which, by evaluating the counit at $A$, gives a map $\mathrm{Tr}_\phi:\mathrm{Hom}_A(B,A)\rightarrow A$ in $\mathsf{Mod}_A$.
Also, given a proper map $f:X\rightarrow Y$ between reasonable schemes (for example essentially finite type schemes over a field) we have the adjunction given by Grothendieck duality $Rf_*:\mathsf D^b_c(X) \substack{\longrightarrow\\\perp \\\longleftarrow \\}\mathsf D^b_c(Y):Rf^!$ which induces (again by evaluating the counit at $\mathcal{O}_Y$) a morphism $\mathrm{Tr}_f:Rf_*Rf^!\mathcal{O}_Y\rightarrow\mathcal{O}_Y$ in $\mathsf{D}_c^b(Y)$
What bothers me is that my original trace, unlike the two trace maps I just mentioned, does not seem to come as naturally from some adjunction or anything like that. Where is it coming from? What is it?