Let $P$ be a free R-module such that $\{p_1,\cdots,p_n\}$ is a basis. To show that $P$ is projective we need to show that if exists $ a: M \rightarrow P $ surjective and R-linear, then $M = \ker(a) \oplus P_1$ with $M$ as a R-module and $P_1 \cong P$.
Here's what I've got by now:
Assume that there is such R-homomorphism $a$. Since it is onto, it follows that $p_i = a(m_i)$ for $m_i \in M$. Now, consider the following homomorphism: \begin{align*} b:P &\rightarrow M\\ \sum r_ip_i &\mapsto \sum r_im_i \end{align*} That homomorphism exists since there are at least $n$ different $m_i$'s in $M$ by our previous conclusion, and it is well defined since $P = Rp_1 \oplus \cdots \oplus Rp_n$.
It follows that: $$ ab(p_i)=a(m_i)=p_i \implies ab(p) = p \quad \forall p \in P \implies ab(p) = \mathbb{1}_P $$ Now, see that if $m \in \ker{a}$ then $m = m - ba(m)$ because $a\big(m - ba(m)\big) = a(m) - aba(m) = a(m) - a(m) = 0$. Therefore we can write any element of $m$ as: $$ [m - ba(m)] + ba(m) $$ and the first term is in $\ker(a)$ and second term is in $b(P)$, hence: $$ M = \ker(a) + b(P) $$ Now suppose $m \in \ker(a) \cap b(P)$. It follows from $m \in \ker(a)$ that $m = m-ba(m)$. It follows from $m \in b(P)$ that $m = \sum r_im_i$. Therefore: \begin{align*} m &= m - ba(m)\\ &= \sum r_im_i - ba\left(\sum r_im_i\right)\\ &= \sum r_im_i - b\left(\sum r_ip_i\right)\\ &= \sum r_im_i - \sum r_im_i = 0 \end{align*} And we conclude that $\ker(a) \cap b(P) = \{0\} \implies M = \ker(a) \oplus b(P)$. Now it remains to show that $b(P) \cong P$. For that, see that: $$ b(P) \cong M/\ker(a) \cong a(M) = P \implies b(P) \cong P $$
Can someone please check my proof? The part of show that $M = \ker(a) + b(P)$ was a bit tricky but it eventually came.
Thanks and any constructive critics about the proof is highly appreciated.
I think you have a confused definition of projective modules. An $R$-module $M$ is called projective if whenever $\pi : A \to B$ is a surjective $R$-module morphism, and $g : M \to B$ is some $R$-module morphism, then there exists some $R$-module morphism $\tilde{g} : M \to A$ with $\pi \circ \tilde{g} = g$. Your definition is that $(M / N) \oplus N \cong M$ for all submodules $N$ of $M$, which is equivalent but this is usually stated as a theorem rather than the definition.
I think your proof is okay, but you should look up something called "the splitting lemma" which encapsulates a lot of what your proof is doing.
Just for the avoidance of doubt, the fact that the basis of $P$ is finite is not required. There is the much more general proposition:
$\textbf{Claim:}$ Let $R$ be a ring, then an $R$-module $M$ is projective if and only if is the direct summand of a free $R$-module.
$\textit{Proof.}$ $(\Rightarrow):$ Suppose first that $M$ is projective, and let $F$ be the free $R$-module on the elements of $M$. Formally $F$ is the direct sum of copies of $R$ indexed by the elements of $M$, and for $m \in M$ let $1_m \in F$ be the basis element of $F$ indexed by $m$. Then there is a surjective $R$-module morphism $\pi : F \to R$ mapping $1_m \mapsto m$. Since $M$ is projective there is an $R$-module morphism $\tilde{\pi} : M \to F$ lifting the identity morphism $M \to M$ through the surjection $\pi$, which is to say $\pi \circ \tilde{\pi} = \operatorname{Id}_M$. But then $\tilde{\pi}$ is injective, and
$$F = \tilde{\pi}(M) \oplus \operatorname{\ker}(\pi) \cong M \oplus \operatorname{\ker}(\pi),$$ and so $M$ is a direct summand of a free module.
$(\Leftarrow):$ Suppose now that $M$ is the direct summand of a free $R$-module, say $F$. Then $F = M \oplus N$ for some $R$-module $N$. Then suppose that $\pi : A \to B$ is a surjective morphism of $R$-modules, with $g : M \to B$ some morphism of $R$-modules. Then $F$ has some basis $$\left\{ f_i \mid i \in \mathcal{I} \right\},$$ say, where $\mathcal{I}$ is some indexing set. Then for each $i \in \mathcal{I}$, there is some unique $m_i \in M, n_i \in N$ such that $f_i = m_i + n_i$. Now we can extend $g$ to a map $g' : F \to B$ by letting $g'(f_i) = g(m_i)$. Then since $\pi$ is surjective there is some $a_i \in A$ with $\pi(a_i) = g'(f_i)$. Then define $\tilde{g} : F \to A$ such that $f_i \mapsto a_i$. Then the restriction of $\tilde{g}$ to $M$ satisfies $\pi \circ \tilde{g} = g$, and so $M$ is indeed projective.