In the non-inertial frame of reference of the spaceship, a centrifugal and a gravitational force acts on the spaceship. If its mass is m and the positive direction is radially outwards, we have:
FG = -GmM/r2 - gravitational force(G is the gravitational constant)
FC = mv2/r - centrifugal force(v is the spaceship's velocity)
the spaceship's orbit is of fixed radius, so it doesn't move radially, thus there is no radial acceleration, when all forces are taken into account. From Newton's second law we have:
FG + FC = ma = 0 - here a is the acceleration of the ship
=> mv2/r - GmM/r2 = 0
v2 = GM/r (1)
The ship has kinetic and potential energies, which are given by the equations:
EK = mv2/2 = GmM/2r - kinetic energy with the substitution from equation (1)
EP = -GmM/r - potential energy, which is only the gravitational potential energy, since there are no other force fields
The total energy is then:
E = EK + EP = GmM/2r - GmM/r = -GmM/2r