Understand a derivation I am learning formal logic through the book An Exposition of Symbolic Logic; in chapter 1, section 10, I am asked to derivate the following argument:

(P→Q) → S
S → T
~T → Q
∴ T

I couldn't work out the solution, so I saw the answer the book tells:


*

*Show T

*~T ass id

*Q 2 pr3 mp

*Show P→Q

*
   Q 3 r cd



*S 4 pr1 mp

*T 6 pr2 mp 2 id


When I saw the derivation on line 4 to 5, I said to myself "this is nonsense!". So I ask: is it wrong? If it is right, could you explain it?
 A: I don't want to spend too much time deciphering this book's idiosyncratic and obscure system of abbreviations.  But I gather that the idea is:

*

*We have already shown $Q$ in step 3.

*We can hypothesize  $P$ in step 5 and then claim that $P\to Q$ because $Q$ has already been shown.

This is sometimes called the rule of reiteration.  (I suppose this is why the author chose the notation r.)  Symbolically, we can write it as $$A \to (B \to A)$$  If we already know $A$, we can conclude that $B$ implies $A$, for any $B$.  In your derivation, because we already know $Q$, we can conclude $P\to Q$.
This is indeed counterintuitive.  It's one of the notorious paradoxes of material implication.  The confusion arises because the formal logical meaning of $A\to B$ is so different from the conventional notion of "if… then…”.
In formal logic, $A\to B$ is a  very weak claim.  It does not say that $A$ causes $B$, or that $A$ and $B$ are related in any way.  All it says is that whenever $A$ is true, $B$ is also true.
But if we interpret $\to$  in this way, $A\to (B\to A)$ is always true.  It says is that whenever $A$ is true, $B\to A$ is also true.  And this is correct!   Because if $A$ is true then, whenever $B$ is true, $A$ is also true.

Perhaps a more straightforward way to prove the theorem would be:  Assume $\sim T$.  From premise 2 conclude $\sim S$ by modus tollens.  From $\sim S$ and premise 1, conclude $\sim(P \to Q)$ by modus tollens.  $\sim (P\to Q)$ means $P\land \sim Q$ by definition, so extract $\sim Q$. From premise 3, conclude $Q$ by modus ponens, a contradiction, and the original assumption $\sim T$ is false.
But I make no guarantees that all these steps are valid in this author's unpleasant logical system.  My advice would be to pick up a secondary text that explains how to do proofs  via analytic tableaux, and learn logic from that.   Once you understand it, writing the proofs in a more natural way, and then translating them into your book's weird formalism, will probably be easier than trying to construct the proofs  directly in the weird formalism.
