proof of the rice's theorem
Let us verify that $S$ is a decider for $A_{\text{TM}} = \{⟨M,w⟩\mid M \text{ is a TM and }M\text{ accepts } w\}$.

Let $⟨M,w⟩\in A_{\text{TM}}$ be the input to $S$. Let us see how $S$ runs according to its specification.


First, construc $M_w$. Since $M$ accepts $w$, $M_w$ simulate $T$.
Use TM $R_P$ to determine whether $⟨M_w⟩ \in P$. Since $M_w$ simulate $T$, $⟨M_w⟩\in P$. So, the answer is YES. So, accept.


Now let $⟨M,w⟩\not\in A_{\text{TM}}$ be the input to $S$. Let us see how $S$ runs according to its specification.


First, construc $M_w$. Since $M$ do not accept $w$, $M_w$ simulate $T_\emptyset$.
Use TM $R_P$ to determine whether $⟨M_w⟩ \in P$. Since $M_w$ simulate $T_\emptyset$, $⟨M_w⟩\not\in P$. So, the answer is NO. So, reject.


The above analysis shows that $S$ is a decider for $A_{\text{TM}}$.

Hope this helps. 



Exercise of a minute or less. Verify that if $M$ do not accept $w$, $M_w$ simulate $T_\emptyset$.