Suppose we define $f\colon \mathcal{M}(n \times n; \mathbb R) \to \mathbb R^n$ by \begin{align*} A \mapsto (\alpha_{n-1}, \dots, \alpha_0), \end{align*} where $(\alpha_{n-1}, \dots, \alpha_0)$ are coefficients of characteristic polynomial $p_A(t) = \det(tI-A) = t^n + \alpha_{n-1} t^{n-1} + \dots + \alpha_0$. $f$ is clearly continuous.
I am wondering what does the preimage $f^{-1}(\beta)$ look like for a fixed $\beta \in \mathbb{R}^n$? In particular, if we take a connected set $E$, is the preimage $f^{-1}(E)$ connected? In general, one would not expect a continuous map to have this property but somehow my intuition keeps thinking this is true.
The preimage of a point under $f$ is not connected in general. For instance, let $n=2$ and let $(\alpha_1,\alpha_0)$ be such that $p(t)=t^2+\alpha_1 t+\alpha_0$ has no real roots. Then any matrix $A$ such that $p_A(t)=p(t)$ has no real eigenvalues. In particular, if $\{e_1,e_2\}$ is the standard basis, then $Ae_1=ae_1+be_2$ for some $a$ and some $b\neq 0$. This gives two nontrivial clopen subsets of $f^{-1}(\{(\alpha_1,\alpha_0)\})$: one on which $b>0$ and one on which $b<0$. (Both of these subsets are nonempty because if you take $A$ in one subset and conjugate it by the matrix $\begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix}$, you get an element of the other subset.)
In general, if $\beta\in\mathbb{R}^n$ corresponds to a squarefree polynomial, then any two matrices in $f^{-1}(\beta)$ are diagonalizable over $\mathbb{C}$ with the same eigenvalues and thus conjugate by an invertible matrix. Thus $f^{-1}(\beta)$ is a continuous image of $GL_n(\mathbb{R})$, and so has at most two connected components. If the polynomial corresponding to $\beta$ has a real root, then any element $A$ of $f^{-1}(\beta)$ has a real eigenvector. Letting $B$ be the map that negates this real eigenvector but is the identity on the other eigenspaces of $A$, we have $\det B=-1$ and $BAB^{-1}=A$. This means that the two components of $GL_n(\mathbb{R})$ acting by conjugation on $A$ actually have the same image, and so $f^{-1}(\beta)$ is connected. In general, though, as the example above shows, $f^{-1}(\beta)$ may have two components.
More generally, there is a section $g:\mathbb{R}^n\to M_n(\mathbb{R})$ of $f$ taking a polynomial to its companion matrix. If $E$ consists of squarefree polynomials, then every matrix in $f^{-1}(E)$ is conjugate to a matrix in $g(E)$, and so $f^{-1}(E)$ is the image of $g(E)$ under the conjugation action of $GL_n(\mathbb{R})$. If $E$ is connected, this means $f^{-1}(E)$ has at most two connected components, one for each component of $GL_n(\mathbb{R})$. That is, one component is the set of matrices conjugate to an element of $g(E)$ by a matrix of positive determinant and one component is those conjugate to an element of $g(E)$ by a matrix of negative determinant, unless these two sets happen to actually just form a single connected set. If any element $\beta\in E$ has a real root, then the two sets will overlap in $f^{-1}(\beta)$ as above, and so $f^{-1}(E)$ will have only one component.
(For polynomials that are not squarefree, there are multiple different conjugacy classes of matrices in $f^{-1}(\beta)$, since you can have non-diagonalizable matrices. I believe that the non-diagonalizable matrices should always accumulate at diagonalizable matrices so $f^{-1}(\beta)$ still has at most two components, but I have not checked the details. I have also not checked whether the two components of $f^{-1}(\beta)$ always are distinct if the polynomial has no real roots, but I suspect they are.)