The parts in the brackets and the power of g are obtained by
dimensional analysis (the coefficient of restitution, being a
ratio of velocities, is dimensionless)
The overall signs are obtained by noting that the first part of
the motion is down and the second up.