Could not understand the formation of equation

Could not understand why the probability is multiplied with the number of steps.

@ayusdas2000
it is the formula of the expectation.
image

that means here number of flips is the random variable x? right

Yes…