I answer your question based on the AES block cipher. You know the mixcolumn of AES is based on $GF(2^8)$ which is constructed from the irreducible polynomial $x^8+x^4+x^3+x+1=0$ over $GF(2)$.
Consider we want to obtain $\mathtt{0x57} \cdot \mathtt{0x02}$. First we see this one by polynomial method
$$
\begin{array}{lcl}\tag{1}
\mathtt{0x57} \cdot \mathtt{0x02}&=&(01010111)_2 \cdot (00000010)_2\\
&=&({x}^{6}+{x}^{4}+{x}^{2}+x+1)\cdot x\\
&=&{x}^{7}+{x}^{5}+{x}^{3}+x^2+x \\
&=& (10101110)_2\\
&=& \mathtt{0xAE}
\end{array}
$$
The relation $(1)$ means that when an element of $\alpha \in\operatorname{GF}(2^8)$ multiplied by an element $\mathtt{0x02}$ we shift the binary mode of $\alpha$ in the left side.
Now, if the first bit (from left) of $\alpha$ is $1$ we should $\operatorname{XOR}$ the results with $\mathtt{0x1B}= (00011011)_2$ since when the first bit is $1$, it means we have $x^7$ in the representation of $\alpha$ and by multiplying by $x$ we get $x^8$ and we use the polynomial $x^4+x^3+x+1$ instead of $x^8$ in our calculation.
We call this operation x_time(). For instance, let we want to get $\mathtt{0x57} \cdot \mathtt{0x04}$. The element $\mathtt{0x04}=(00000100)_2$ is equal to $x^2$. Therefor to obtain $\mathtt{0x57} \cdot \mathtt{0x04}$ we use the function x_time() two times. In $(1)$ we got $\mathtt{0x57} \cdot \mathtt{0x02}=\mathtt{0xAE}$.
In the rest, to obtain $\mathtt{0xAE} \cdot \mathtt{0x02}$, first we shift the binary mode of $\mathtt{0xAE}=(10101110)_2$ in the left side that implying that $$
(10101110)_2 \stackrel{shift\, to\, left}{\Longrightarrow} (01011100)_2 \tag{2}
$$
The first bit of $\mathtt{0xAE}=(10101110)_2$ is $1$ and hence we $\operatorname{XOR}$ the result obtained in $(2)$, with $(00011011)_2$ as follows
$$
(01011100)_2 \quad \operatorname{XOR}\quad (00011011)_2=(01000111)_2=71=\mathtt{0x47}
$$