Let $k$ be a commutative ring and $B$ an algebra over $k$. Consider a projective and finitely generated right $B$ module $M$. We equip $Hom_B(M,B)$ here with a $B$-module structure given by left action $$B\times Hom_B(M,B) \to Hom_B(M,B) \\ (b,f) \mapsto bf(m)$$ where $B$ is a module over itself, with action of multiplication in $B$.
Moreover, one gives $B$-module structure to $End_B(M)$ via left action $$B\times End_B(M)\to End_B(M) \\ (b,T) \mapsto m \mapsto T(m)b$$
I want to verify $M\otimes_B Hom_B(M,B) \simeq End_B(M)$.
As I don't have any smart idea, I tried to do it by definition: Let $g: M \times Hom_B(M,B) \to N$ be $B$-bilinear function. Now pose $$\phi: M \times Hom_B(M,B) \to End_B (M) \\ (m,f) \mapsto m' \mapsto m'f(m),$$ which is a $B$-bilinear function. And I'm stuck here: what I need is a $B$-linear map $\widetilde{\phi}:End_B(M) \to N$ such that $g=\widetilde{\phi}\phi$.
Does anyone have an insight or smarter idea?
There is a natural map $\phi:M\otimes\hom(M,B)\to\hom(M,M)$ such that $\phi(m\otimes f)(m')=mf(m')$. As you note, this is an isomorphism if $M$ is finitely generated and projective, and usually not an isomorphism if not. It follows that if we want to exhibit an inverse we have to use the hypothesis somehow: the map $\phi$ can be written down for all $M$ but the inverse has to have some problem or another.
Let $(f_i,m_i)_{i\in I}$ be a finite dual basis for $M$, that is, let $I$ be a finite set, $m_i\in M$ and $f_i:M\to B$ for each $i\in I$, and $m=\sum_{i\in I}f_i(m)m_i$ for all $m\in M$. Then we can define a map $\psi:\hom(M,M)\to M\otimes \hom(M,B)$ putting $$\psi(g)=\sum_{i\in I} g(m_i)\otimes f_i$$ for all $g\in\hom(M,M)$. You should have no problem showing that $\phi$ and $\psi$ are mutually inverse.