The Chinese Remainder Theorem can be stated in a few ways:

(i) If $N = N\_1N\_2\cdots N\_k$ and the $N\_i$ are pairwise coprime we have a canonical isomorphism $$\mathbb{Z}/N\mathbb{Z} \cong \mathbb{Z}/N\_1\mathbb{Z} \oplus \cdots \oplus \mathbb{Z}/N\_k\mathbb{Z}$$
(ii) For any $a\_i \bmod N\_i, \quad i = 1,\ldots, k$ there exists an $a$ such that $a \equiv a\_i \bmod N\_i$ for all $i$.

My question is how are these definitions equivalent and how is the isomorphism in the first definition true?

Also, the value of $a$ can be found via the Euclidean Algorithm. That is, put $M\_i = N/N\_i$. By assumption $M\_i$ and $N\_i$ are relatively prime. Then find $X\_i$ with $X\_iM\_i \equiv 1 \bmod N\_i$ and put $$a = \sum\_{i=1}^k a\_iX\_iM\_i$$

I am also confused how this uses the euclidean algorithm and finds the value of $a$.