What do the components of $\operatorname{Hom}(\pi_1(S),\operatorname{SL}_n(\mathbb{R}))$ look like? Let $S$ be a closed orientable surface of genus at least $2$. I'm interested in the connected components of $\operatorname{Hom}(\pi_1(S),\operatorname{SL}_n(\mathbb{R}))$ for $n$ at least $3$.
I know that for $n$ odd there is only $3$ connected components. My first question is:

*

*For $n$ even, do we still have $3$ connected components?

Suppose $n$ is odd. There is the connected component containing the trivial representation, the Hitchin component and another one. My second question is:


*What do we know about the connected component which doen't contains the trivial or Hitchin representations? Can we construct an explicit representation in it? Can any representation in it be deformed to have image in a compact group?

Thanks
 A: As mentioned in the comment above, this falls into the field of higher Teichmüller theory. Most of these questions are answered in the paper which initiated higher Teichmuller theory: Hitchin's paper where Hitchin components were parameterized using Higgs bundles.
This paper contains a proof that $\rm{Hom}^+(\pi_1(S), \rm{PSL}(n, \mathbb{R}))/\rm{PSL}(n,\mathbb{R})$ (where the $+$ denotes that we restrict our attention to representations acting completely reducibly on $\mathfrak{sl}(n,\mathbb{R}))$ has $6$ components when $n > 2$ is even. If $n$ is even, an outer automorphism of $\text{PSL}(n, \mathbb{R})$ interchanges the Hitchin component with another component of the character variety, giving a description of another component.
The proof that yields the count of components of $\rm{Hom}^+(\pi_1(S), \rm{PSL}(n, \mathbb{R}))/\rm{PSL}(n,\mathbb{R})$ in Hitchin's paper also shows that non-Hitchin components contain representations with image in $\text{PSO}(n, \mathbb{R})$. Analysis of which components' representations lift to $\rm{SL}(n,\mathbb{R})$ is also in the paper.
One relevant paper to the question of producing representations that springs to mind is this recent paper of Lee, Lee, and Stecker. It examines representations of triangle groups into $\text{SL}(3,\mathbb{R})$ that contain surface groups as finite index subgroups. This produces one-parameter families of representations containing some Anosov representations and some non-Anosov representations.
A: $\DeclareMathOperator\Hom{Hom}\DeclareMathOperator\SL{SL}\DeclareMathOperator\PSL{PSL}\DeclareMathOperator\PGL{PGL}\DeclareMathOperator\GL{GL}\DeclareMathOperator\SO{SO}\DeclareMathOperator\R{\mathbb{R}}$Just to set the notation, as in the OP's question, let $S$ be a closed orientable surface of genus $g$ at least 2, and $G$ is a Lie group.  The question concerns connected components of $\Hom(\pi_1(S),G)$ with respect to the subspace topology where we identify $\Hom(\pi_1(S),G)$ with a subset of $G^{2g}$ by evaluation.  The question in particular concerns the case $G=\SL(n,\mathbb{R})$, however this case is very much related to three other cases, so I will summarize all four cases.  We assume $n\geq 2$ everywhere below.
The first paper to mention is:
Goldman, W., Topological components of spaces of representations.
Invent. Math. 93 (1988), no. 3, 557–607.
In that paper, among other foundational results, it is shown that for $G=\SL(2,\mathbb{R})$ there are $2^{2g+1}+2g-3$ components, and for $G=\PSL(2,\mathbb{R})$ there are $4g-3$ components.
Then next foundational paper to mention (as already noted by others) is:
Hitchin, N., Lie groups and Teichmüller space. Topology 31 (1992), no. 3, 449–473.
In that paper, for $G=\PSL(n,\mathbb{R})$ and $n\geq 3$, there are 3 components if $n$ is odd, and 6 if $n$ is even.
Remark:  Since $\PSL(n,\mathbb{R})=\SL(n,\mathbb{R})$ when $n$ is odd, this also gives 3 components for $G=\SL(n,\mathbb{R})$ for all odd $n$.
Next, let's mention the paper in Eugene Xia:
Xia, E., Components of $\Hom(\pi_1,\PGL(2,\mathbb{R}))$. Topology 36 (1997), no. 2, 481–499.
In that paper, it is shown there are $2^{2g+1}+4g-5$ components for $G=\PGL(2,\mathbb{R})$.
Generalizing the above result, we have:
Oliveira, A., Representations of surface groups in the projective general linear group. Internat. J. Math. 22 (2011), no. 2, 223–279.
In this paper, it is shown there are $2^{2g+1}+2$ components for $G=\PGL(n,\mathbb{R})$ when $n\geq 4$ and even (which completes the picture for this group given prior results listed above).
Lastly, we mention (out of order):
Bradlow, S.; García-Prada, O.; Gothen, P., Representations of surface groups in the general linear group. Proceedings of the XII Fall Workshop on Geometry and Physics, 83–94, Publ. R. Soc. Mat. Esp., 7, R. Soc. Mat. Esp., Madrid, 2004.
In this paper, it is shown there are $3(2^{2g})$ components when $G=\GL(n,\mathbb{R})$ and $n\geq 3$.
Finally to answer your question.  As explained to me by a much more knowledgeable friend (André Oliveira), implicit in the latter two papers is that for $G=\SL(n,\mathbb{R})$ there are $2^{2g+1}+2$ components when $n\geq 4$ and even.
Here what I understood (any errors are my own):
There is only one topological type, determined by the second Stiefel-Whitney class (which takes 2 values). For one value the moduli space is connected.  This component contains only representations homotopic to those which factor through $\SO(n)$. For the other value, there is one component like the previous one, but also $2(2^{2g})$ components coming from a choice of a square root of the canonical line bundle for each of the two Teichmüller components in the $\PSL(n,\R)$ case.
Remarks:

*

*For the $\GL(2,\R)$ case see:
Baraglia, D.; Schaposnik, L., Monodromy of rank 2 twisted Hitchin systems and real character varieties. Trans. Amer. Math. Soc. 370 (2018), no. 8, 5491–5534.

*For $g=1$ and any real reductive $G$, or $g\geq 2$ and $G$ compact or complex reductive, the number of components is equal to the order of $\pi_1([G,G])$.  For the $g=1$ case, see Proposition 5.1 (and the references in its proof) in  Sikora, A., Character varieties of abelian groups. Math. Z. 277 (2014), no. 1-2, 241–256.  For the $g\geq 2$ and $G$ complex reductive (with references for the compact case), see the Appendix of Lawton, S.; Ramras, D., Covering spaces of character varieties. With an appendix by N. Ho and C. Liu. New York J. Math. 21 (2015), 383–416.

*For non-orientable $S$ and $G=\PSL(2,\R)$ or $\PGL(2,\R)$ see Palesi, F., Connected components of spaces of representations of non-orientable surfaces. Comm. Anal. Geom. 18 (2010), no. 1, 195–217. and also Palesi, F., Connected components of PGL(2,R)-representation spaces of non-orientable surfaces. Geometry, topology and dynamics of character varieties, 281–295, Lect. Notes Ser. Inst. Math. Sci. Natl. Univ. Singap., 23, World Sci. Publ., Hackensack, NJ, 2012.

