On Demand Review - Ch 8, Power Flow Quiz

Can you help me understand where these S’ equations are coming from in both of these questions?