How I can prove that if $A$ is a ring and $f\in A$ is not nilpotent then $A_f\cong A[T]/(Tf-1)$?
My attempt is the following.
I define the homomorphism $\phi : A[T]\longrightarrow A_f$ in this way: $\phi(a):=a/1$ and $\phi(T^n)=1/f^n$. Now, of course $(Tf-1)\subseteq \ker \phi$, but I'm not able to prove the reverse inclusion.
I think your struggle to show $\operatorname{ker} \phi \subset (Tf-1)$ is a good reason to give you the following general advice: You don't have to show the inclusion by the virtue of a little workaround (as suggested in the comments).
When one wants to show $A/B \cong C$ (isomorphism of modules, rings, groups...) one often gives a map $\phi: A \to C$ and most of the times it is trivial to show that the map is surjective and $\phi(B)=0$. The missing part is $\operatorname{ker} \phi \subset B$ which might be a little bit harder. But one can also do the following:
Note that $\phi(B)=0$ at least gives you a map $A/B \to C$, which is surjective because $\phi$ is. To show that it is an isomorphism, it is enough to give a left-inverse (if the category has the nice property that an isomorphism is the same as a bijective morphism, for example modules or rings) or a both-sided inverse (if the category does not have this property).
Hence you just have to give a map $C \to A/B$ and check that $A/B \to C \to A/B$ is the identity map.
In our case, we note that the natural map $A \to A[T]/(Tf-1)$ maps $f$ to a unit, i.e. it factors through the localization $A_f$ and yields a map $A_f \to A[T]/(Tf-1)$. It is straight forward to check that $$A[T]/(Tf-1) \to A_f \to A[T]/(Tf-1)$$ is the identity map, i.e. $A[T]/(Tf-1) \to A_f$ is injective (and you already know that is is surjective) and thus an isomorphism.
To check that the composition is indeed the identity, it is enough to track the image of $T$, since the map is uniquely determined by the image of $T$.