Phase of signals in real and complex DFT
And all of these waves have phase equal to 0.

No. The phase will be zero for $X[0]$ (DC -zero frequency component) but the phase is given by $arctan(Im[i]/Rx[i])$, which usually doesn't result in zero.

Yet if we use the forward DFT formula
$$X[r] = {\sum}_{k=0}^{N-1} x[k]e^{-j(2 \pi k r / M)} $$
to compute ($M$ is usually considered to be equal to $N$), the output
is a sequence consisting of $N$ complex numbers, for a input sample
with size $N$.

N output complex numbers requires just as many input complex numbers (which means you need N real numbers and N imaginary numbers (all zeros) as input, which together make up the complex input).
If, the input is ,however, purely real (N real numbers), and you don't provide an imaginary part, your real fft algorithm will simply treat your input as complex (for instance, the even numbers will be treated as real and odd as imaginary) but now you'll get only $N/2+1$ complex numbers at the output.
I

s it the case that the frequency components have amplitude $A =
&gt; \sqrt{a^2 + b^2}$, phase $\varphi = \arccos{(\frac{a}{A})}$ and they
are shifted sine waves?

Yes, but the the phase fomula is actually $\varphi = \arctan{(\frac{b}{a})}$
EDIT: As mentioned in a comment below, one generally needs to use $atan2$.