I am self-studying for an actuarial exam and I encountered this example. The books shows one method of solving using a replicating portfolio, and then shows this solution involving risk-neutral probabilities.
My question is - I do not understand where the equations highlighted in red come from.