I'm going through Rosenberg's Algebraic K-theory and its applications. The following is a screenshot from the first few pages.
The definition of projective left $R$-module $P$ is: for any surjective hom $\alpha: M \twoheadrightarrow P$ there exists a right inverse $\beta : P \to M$ (i.e. such that $\alpha \circ \beta = \text{id}_P$).
The goal is to show that this is equivalent to the usual definition of projective module given in commutative diagrams at the top of the screenshot (i.e. that a commutative triangle can be completed for any surjection $\psi: M \twoheadrightarrow N$ and any hom $\varphi: P \to N$).
At the bottom of the screenshot it says we may replace $N$ by $\text{im}((\varphi, \text{id}_P))$ and $M$ by $\psi^{-1}(\text{im}(\varphi))$. Firstly, do they mean replace the $N$ in $N \oplus P$ or the original $N$ (alone). And, I don't understand how this will be the same problem as the original, so could you explain this section to me in detail? Alternatively can you give a proof with more clarity?

The final paragraph is less than clear, so it is no wonder you are a bit confused. Taken literally it might lead you astray (I will note where below). Also, this seems needlessly complicated to me, so I will indicate an alternative argument below after explaining what they are doing.
You are trying to prove that if every surjection onto $P$ has a right inverse, then the module $P$ is projective; that is, that whenever you have a surjection $M\to N$ and a map from $P$ to $N$, you can factor that map through $M$.
So, let $\psi\colon M\to N$ be a surjection, and let $\phi\colon P\to N$ be a map. We want to show that there exists a morphism $\theta\colon P\to M$ such that $\phi=\psi\circ\theta$.
To that end, we will construct a surjection onto $P$ whose right inverse will help us find $\theta$.
Let’s take the module $M\oplus P$, and map it to the module $N\oplus P$ by the map $(\psi,\mathrm{id}_P)$. This map takes $(m,p)$ and sends it to $(\psi(m),p)$. This is a surjection, since $\phi$ and $\mathrm{id}_P$ are surjections: given $n\in N$ and $p\in P$, there exists $m\in M$ such that $\psi(m)=n$, and then $(m,p)$ maps to $(n,p)$.
Let us also replace the morphism $P\to N$ with the morphism $P\to N\oplus P$ given by $(\phi,\mathrm{id}_P)$. This map takes $p\in P$ to $(\phi(p),p)$. Now we have a new diagram: $$\begin{array}{ccl} &&P\\ &&\downarrow(\phi,\mathrm{id}_P)\\ M\oplus P&\stackrel{(\psi,\mathrm{id}_P)}{\longrightarrow} & N\oplus P \end{array}$$ Note that the vertical arrow is now one-to-one: for given $p\in P$, if $(\psi,\mathrm{id}_P)(p) = (0,0)$, then $p=0$.
Now we will replace this diagram yet again; it is here that they are less than clear. Taken literally, we would replace $N$ and $M$, but in fact we will replace $N\oplus P$ and $M\oplus P$: instead of $N\oplus P$, let us put $\mathrm{Im}(\psi,\mathrm{id}_P)= N’$ (for ease; but note that this is a submodule of $N\oplus P$); and instead of $M\oplus P$, we will put $(\psi,\mathrm{id}_P)^{-1}(N’)$. $$\begin{array}{ccl} &&P\\ &&\downarrow(\phi,\mathrm{id}_P)\\ (\psi,\mathrm{id}_P)^{-1}(N’)&\stackrel{(\psi,\mathrm{id}_P)}{\longrightarrow} &N’ \end{array}$$ Note that the bottom arrow is still surjective, and the vertical arrow is still injective (the latter is just a restriction of the previous vertical arrow). But now the vertical arrow is an isomorphism: it is surjective by construction. So the vertical arrow is now an isomorphism.
So now we have a surjection $$(\psi,\mathrm{id}_P)^{-1}(N’)\stackrel{(\psi,\mathrm{id}_P)}{\longrightarrow} N’\stackrel{(\phi,\mathrm{id}_P)^{-1}}{\longrightarrow} P.$$ We can take the inverse at the end because the restriction of $(\phi,\mathrm{id}_P)$ was an isomorphism.
This composition is a surjection, so it has a right inverse $\beta\colon P\to (\psi,\mathrm{id}_P)^{-1}(N’)\leq M\oplus P$. We claim that if you take this $\beta$ we will get the extension we want to start with (that is, the map $P\to M$ we are looking for); well, not quite this extension, but rather $\pi_M\circ\beta\colon P\to M$.
To verify this, take $p\in P$. The $\beta(p)$ has the property that $(\phi,\mathrm{id}_P)\circ(\psi,\mathrm{id}_P)^{-1}(\beta(p))=p$. So $\beta(p)=(m,q)$ for some $m\in M$ and $q\in P$. Then $(\phi(m),q)$ must be equal to $(\psi(p),p)$. Thus, $q=p$, and $\psi(p) = \phi(m)=\phi(\pi_M(\beta(p)))$.
Thus, $\pi_M\circ\beta\colon P\to M$ has the property that $\phi(\pi_M\circ\beta(p))=\psi(p)$, hence this is the morphism we are looking for.
Now, I think the instructions to replace and replace again are a little too complicated (as may be apparent above). We can do all of the above without so much be using a free module as an auxiliary. This uses a third equivalent condition to being free:
Theorem. Suppose that $P$ is a module such that every surjection $M\to P$ has a right inverse. Then there exists a module $Q$ such that $Q\oplus P$ is free.
Proof. Let $F$ be a free module that surjects onto $P$ (this is always possible; e.g., you can take the free module on the underlying set of $P$), $\pi\colon F\to P$. Then this surjection has a right inverse $\beta\colon P\to F$. Since $\pi\beta=\mathrm{id}_P$, then $\beta$ is injective. Now let $Q=\mathrm{ker}(\pi)$. If $x\in Q\cap \beta(P)$, then $x=\beta(p)$, so $0=\pi(x)=\pi(\beta(p))=p$. Thus, $Q\cap\beta(P)=\{0\}$. Now let $x\in F$. then $x-\beta(\pi(x))\in Q$, $\beta(\pi(x))\in \beta(P)$, so $x=\beta(\pi(x))+ (x-\beta(\pi(x)) \in \beta(P)+Q$. Thus, $F=\beta(P)\oplus Q\cong P\oplus Q$, as desired. $\Box$
Note: In fact, this is also equivalent to being projective, and the equivalence theorem that I am familiar with usually places all three conditions, not just the two you are dealing with.
So: assume that every surjection onto $P$ has a right inverse. In particular, there exists a $Q$ such that $P\oplus Q$ is free.
Now assume we have a surjection $\psi\colon M\to N$ and a morphism $\phi\colon P\to N$. Let $Q$ be such that $Q\oplus P$ is free, $F$, and let $f\colon F\to N$ be given by $f(x) = \phi(\pi_P(x))$, where $\pi_P\colon Q\oplus P\to P$ is the projection onto the second coordinate. Let $B$ be a basis for $F$.
For each $b\in B$, $f(b)\in N$, hence there exists $m\in M$ such that $\psi(m)=f(b)=\phi(\pi_P(x))$. Define a map $\Theta\colon B\to M$ by $\Theta(b)=m$ for any one such choice of $m$. Since $F$ is free, this defines a (unique) morphism $\Theta\colon F\to M$. Now let $\theta\colon P\to M$ be given by $\theta(p) = \Theta(0,p)$. Then $\psi(\theta(p)) =\phi(\pi_P(0,p)) = \phi(p)$. Hence $\psi\circ\theta = \phi$, which is what we need.