Consider the equation
\[ x^2+y^2=z^2. \]
The solutions in integers are known as Pythagorean triples. If we use the complex number $i$, $i^2=-1$, then we can decompose the left hand side of the equation as follows:
\[ (x+yi)(x-yi)=z^2.\]
This leads us to the ring of Gaissian integers
\[ R=\{x+iy : x,y \in \mathbb{Z}\}.\]
The ring $R$ has similar properties like $\mathbb{Z}$, the ring of usual integers. We can prove that any number in $R$ is uniquely expressed as a product of *prime numbers* in $R$. If $A$, $B$, $C$ in **Z**, $A$ and $B$ have no common divisor greater than 1, and
\[ AB = C^2 ,\]
then we see that $A$ and $B$ are both square numbers by unique factorization property. Similarly, if $(x, y, z)$ is a Pythagorean triple and $x$ and $y$ have no common divisor greater than $1$, then we see that $x+yi$ and $x-yi$ are both square numbers in $R$. We also see that one of $x$ and $y$ is odd and the other is even. So we may assume $x$ is odd and $y$ is even. Then we have
\[ x+yi=(a+bi)^2=a^2-b^2+2abi,\]
hence
\[ x=a^2-b^2, \quad y=2ab, \quad z=a^2+b^2.\]

As we saw in the argumnet above, it is very useful to consider certain rings like the ring of Gaissian integers for many problems on usual integers. Such a ring is called *the ring of algebraic integers in an algebraic number field* . An *algebraic number* is a complex number which is a root of an algebraic equation
\[ X^n+a_1X^{n-1}+\cdots+a_{n-1}X+a_n=0,\]
where $a_i$'s are rational numbers. An *algebraic integer* is a complex number which is a root of an algebraic equation
\[ X^n+a_1X^{n-1}+\cdots+a_{n-1}X+a_n=0,\]
where $a_i$'s are usal integers. An algebraic number field $K$ is a subfield of the field of complex numbers which is a finite dimensional vector space over the field of rational numbers. $K$ is of the form
\[ K=\{ c_0+c_1\theta+ \cdots+ c_{n-1}\theta^{n-1}: c_i \in \mathbb{Q}\},\]
where $\theta$ is an algebraic number. The ring of integers in $K$ is the set of all algebraic integers in $K$. We denote it by $\mathcal{O}_K$. The unique factorization property does not hold in the ring $\mathcal{O}_K$ in general. However, there is an invariant to measure how far it is from the unique factorization property. It is called the class number of $K$.

If you want to know more on algebraic number fields, I recommend you to read

K. Ireland & M. Rosen, A Classical Introduction to Modern Number Theory, Springer 1990.