A number of papers (with A. S. Rapinchuk and V. I. Chernousov) were devoted to an investigation of representation varieties $R_n(\Gamma)$ and character varieties $X_n(\Gamma)$ for some classes of finitely generated groups, in particular, for fundamental groups of compact surfaces. It is proved that if $\Gamma=\Delta_g$ is a fundamental group of a compact orientable surface of genus $g$, then $R_n(\Delta_g)$ is an irreducible $\mathbb{Q}$-rational variety for all $n$ and $g$. It is obtained a full description of representation and character varieties of fundamental groups $\G_g$ of compact non-orentable surfaces. Developed methods were used for description of $n$-dimensional representation and character varieties both of wide class of groups with one relation and several groups of $F$-type. The problem of decomposing finitely generated groups into non trivial free product with amalgamation is investigated in a number of papers. It is proved that a group with two generators and one relation with torsion is a non trivial free product with amalgamation. Decomposing generalized triangle groups is investigated. As a corollary we proved that Fuchsian groups $H_1=\langle a,b\mid [a,b]^n=1\rangle$ and $H_2=\langle a,b\mid a^2=[a,b]^n=1\rangle$, where $n\ge2$, are non trivial free products with amalgamation. It is proved that if the dimension of a character variety of representations of a finitely generated group $\Gamma$ into $SL_2(\mathbb{C})$ is greater than 1 then $\Gamma$ is a non trivial free product with amalgamation.