Hello, in relation to Markov chains, could you please clarify the following equations:

In particular, could you please expand on why the first line is equal. Surely from , along with the first equation, this implies that:

I just don't see why they are all equal. Please could you provide some intuition on this. Thanks