What makes the electrical charge inside the neuron more positive at the end of action potential and returns it to resting potential?
The issue is the permeability of the membrane to Potassium and how membrane potential is created in the first place. The resting membrane potential of the neuron is very close to the equilibrium potential of Potassium. Large fixed anions (proteins) in the cytosol are represented in the image below by [An-]:



If Potassium and cytosolic proteins were the only thing inside the cell and the outside were water (ignoring osmotic effects), then in Figure 1 there is an outward K+ concentration gradient.
In Figure 2, we allow the membrane to become permeable to Potassium (as it is in the cell). The Potassium begins to leave [green arrow], but as it does, it begins to create a charge separation that sets up a negative voltage in the cell that pulls the Potassium cation back in [red arrow].
In Figure 3, we see that enough K+ has left the cell to the point that the membrane potential has grown negative enough that the rates of K+ leaving and entering are equal, so no net change in K+ concentration occurs. This is the definition of chemical equilibrium, and so we call this voltage the equilibrium potential of this single-ion system (~-80mV for biologic concentrations of K+).


We could do a similar experiment with Na+ starting high outside in Figure 1, with the arrows reversed, and the equilibrium potential of the Sodium-only system would be ~+60mV.

So, if a real cell has both K+ and Na+ concentration gradients in opposite directions, why don't they just cancel each other out? Why is the resting membrane potential negative, and in fact, much closer to the equilibrium potential for Potassium alone? The answer is: permeability. Imagine if you had Figure 1 again, with [K+] high inside, and [Na+] high outside, as it is in the cell, but in Figure 2 you ONLY made the membrane permeable to K+. Would the Na+ gradient change at all? No, because there would be no pathway for it to move. Thus, if ALL the permeability is for K+, then K+ has all the influence on the membrane potential. If both are equally permeable, it would be their average (-10 mV, or about neutral).

However, the permeability for K+ AT REST is about 20 times the permeability for Na+, so we'd expect the cell's resting potential to be 1/20th of the 140mV "distance" between the equilibrium potentials for K+-only and Na+-only systems, or: -80mV + 1/20(140mV) = -73mV. The fact that it's not exactly -73mV is explained by the existence of a small amount of Cl- and other ion permeability. But, in essence, Potassium determines the resting potential, with a little offset due to sodium permeability.

Now that you understand that, understanding the action potential graph should be easy:


Rising Phase: major increase in Na+ permeability, voltage rises almost to the equilibrium potential of Sodium.
Falling Phase/Undershoot: Na+ permeability shuts down, major increase in K+ permeability, voltage drops back down to equilibrium potential of K+.
Restoration: K+ permeability drops back to normal (not completely shut down), and the Na+/K+ pump just restores the concentration gradients that allow the resting potential in the first place.


So, really, your initial confusion about the electrical work done by the Na+/K+ pump existed because you didn't take it in context with the permeability. Yes, the pump by itself makes the voltage more negative, but some of the potassium it stuffs back into the cell immediately turns around and leaks right back out until it's 95% of the way to its own equilibrium point again, as determined by the membrane permeability.