$\det(A+tB)=\det(f(A)+tf(B))$ Let $f:\mathcal{M}_n(\mathbb{C})\longrightarrow\mathcal{M}_n(\mathbb{C})$ a surjective function such that for all $A,B\in\mathcal{M}_n(\mathbb{C})$ and for all $t\in\mathbb{C}$, 
$$ \det(A+tB)=\det(f(A)+tf(B)) $$
How can one show that $f$ is bijective and that $\mathrm{rank}(f(A))=\mathrm{rank}(A)$ for all $A\in\mathcal{M}_n(\mathbb{C})$?

Then, for all matrices $A$, and all complex numbers $t$, $\det(f(A)+tf(0_n))=\det(A)$. Since $f$ is surjective, in particular, $\det(I+tf(0_n))$ is constant. This implies $f(0)$ nilpotent. 
Now, if $f(0_n)$ is nonzero, we have a non-invertible matrix $M=f(M_1)$ such that $M+f(0_n)$ is invertible. Then $f(M_1)$, $M_1$, $M_1+0_n$, and $f(M_1)+f(0_n)$ have the same determinant, which must be both zero and nonzero. So $f(0_n)=0_n$. 
As a consequence, $f(I_n)$ has determinant $1$, so we can replace $f$ with $f_1(M)=f(I_n)^{-1}f(M)$ and thus assume $f(I_n)=I_n$. 
Thus $f(A)$ and $A$ have the same characteristic polynomial for all $A$. 
In particular, a matrix is invertible iff its image is invertible. 
Assume that $A_1$ and $A_2$ have the same image. Then for all matrices $B$, $A_1+B$ and $A_2+B$ have the same determinant. So with $D=A_2-A_1$, for all matrices $B$, $B$ and $B+D$ have the same determinant. By a similar argument to the “$f(0_n)=0_n$” it follows that $D=0$, thus $f$ is injective. 
Note then that for all matrices $f(A)$ and $B$, $f(tB)+f(A)$ and $tf(B)+f(A)$ have the same determinant, so, by the same argument and since $f$ is surjective, $f(tB)=tf(B)$. 
The rest follows from the following lemma: let $A$ be a matrix, and consider, for any matrix $B$, the map $\delta_B(t)=\det(A+tB)$. Then the dimension of the kernel of $A$ is the greatest integer $k$ satisfying: for all $B$, $\delta_B$ is a polynomial of which $0$ is a root of multiplicity at least $k$. 
