Let $G$ be a compact abelian group. Then we know, because of the Peter-Weyl theorem, that $L^2(G)$ decomposes as a Hilbert space direct sum of 1 dimensional representations of $G$.
Let $\mathbb{A}$ denote the adeles for $\mathbb{Q}$. Suppose we are given an automorphic funtion $\phi:GL_2(\mathbb{A})\to \mathbb{C}$ (I am following the book of Gelbart, Automorphic forms on adele groups, definition 3.3). In particular, $\phi(\gamma g)=\phi(g)$, for $\gamma\in G(\mathbb{Q})$.
Fix $g\in G(\mathbb{A})$, then we get a function on $\mathbb{Q}\backslash\mathbb{A}$ defined as
$$x\mapsto \phi\left(\left(\begin{array}{cc}1 & x\\ 0 & 1\end{array}\right)g\right)$$ This being a smooth function on the compact abelian topological group $\mathbb{Q}\backslash \mathbb{A}$ we can write its Fourier series, and the Fourier coefficient for the character $\psi$ will be
$$W_{\phi,\psi}(g)=\int_{\mathbb{Q}\backslash \mathbb{A}}\phi\left(\left(\begin{array}{cc}1 & x\\ 0 & 1\end{array}\right)g\right)\psi(x)^{-1}dx$$ Using the Fourier coefficients we may write
$$\phi(g)=\sum_{\psi}W_{\phi,\psi}(g).$$
For $GL_n$ where $n>2$ one defines analogous objects $$W_{\phi,\psi}(g)=\int_{N(\mathbb{Q})\backslash N(\mathbb{A})}\phi(xg) \psi(x)^{-1}dx$$ However, the space $N(\mathbb{Q})\backslash N(\mathbb{A})$ is no more a topological group, though it is compact. Instead of doing this, why don't we simply repeat the process for the $n=2$ case, that is, for $g\in GL_n(\mathbb{A})$ consider, for example, the inclusion of $\mathbb{A}$ in $GL_n(\mathbb{A})$ given by $x\mapsto U(x):=I+xE_{12}$ where $E_{12}$ is the matrix whose $12$ entry is 1 and all other entries are 0. The function $x\mapsto \phi(U(x)g)$ is a smooth function on $\mathbb{Q}\backslash \mathbb{A}$ and we can define the Fourier coefficients as before, that is,
$$W_{\phi,\psi}(g)=\int_{\mathbb{Q}\backslash \mathbb{A}}\phi(U(x)g)\psi(x)^{-1}dx$$ EDIT
Then one has $$\phi(U(x)g)=\sum_{\psi}W_{\phi,\psi}(g)\psi(x)$$ Once again, put $x=0$ to get $$\phi(g)=\sum_{\psi}W_{\phi,\psi}(g).$$
I have not checked this very carefully, but, I guess, as mentioned in the response below we will also have
$$ \phi(g)=\sum_{\gamma\in \mathbb{Q}} W_\phi\left(\begin{pmatrix}\gamma&0\\0&1\end{pmatrix}g\right).$$
My question is why do we need to work with the more complicated object $N(\mathbb{Q})\backslash N(\mathbb{A})$. Moreover, if we have to work with this object, then is there an analogous theory of Fourier series behind this.