I know that for an equation of real numbers you could calculate the modulus as follows (if I am not mistaking):
$$ x = a + b$$ $$|x| = \sqrt{a^2+b^2}$$
But now I found this equation with this result:
$$|K| = |1-\cos 2k(L-x)+j \sin 2k(L-x)| = \\ \sqrt{(1+ \cos^ 2 2k(L-x)-2\cos 2k(L-x)+ \sin^2 2k(L-x))} = \\ \sqrt{2-2\cos 2k(L-x)}$$
Could someone please explain me how they got that result and what formula they may have used?
The absolute value of a complex number is $$|a + j b| = \sqrt{a^2 + b^2}$$
So you have
$$|K| = \sqrt{ (1 - \cos 2k(L-x))^2 + (\sin 2k(L-x))^2 }$$
Algebraically expanding gives your second line, then the third line is found by the identity
$$ \cos^2 t + \sin^2 t = 1 $$