I really like to know the exact way how its done. Here is what I wrote:
$5$ must have a multiplicative inverse because $\text{ gcd }(12,5)=1$
So $5x \equiv 1 \text{ mod } 12 \Leftrightarrow x \equiv 5^{-1}(\text{mod } 12)$
$$12=5 \cdot 2+2$$
$$5=2 \cdot 2+1$$
$$2=1 \cdot 2+0$$
$\Rightarrow$
$$1=5-2 \cdot 2$$
$$1=5-2 \cdot (12-5 \cdot 2)$$
$$1=5-2 \cdot 12+4 \cdot 5$$
$$1=-2 \cdot 12 + 5 \cdot 5$$
From an online calculator, I know that $5$ is its own inverse. But how do you know that from the last notation?
Please don't explain it too complicated, I have very big troubles in understanding it and I'm already very happy I was able to calculate it till here myself.
Take a very close look at the last line: $$1 = -2 \cdot 12 + 5 \cdot 5.$$
Literally this is saying that $1$ is the sum of a multiple of $12$ and $5\cdot 5$. Since $5\cdot 5$ differs from $1$ by a multiple of $12$, this means $5\cdot 5 \equiv 1 \pmod{12}$, so $5$ is an inverse of $5$ modulo $12$.
More generally, any time you have an integer identity of the form $$1 = m\cdot n + a\cdot b,$$ you can, if you read carefully, conclude quite a few related facts, such as:
The Euclidean algorithm is very powerful indeed :).