A uncharged capacitor C is connected to a battery with potential V
Since the voltage across a capacitor must be continuous (for finite current), one cannot specify this and expect to get valid answers.
Remember, for the ideal capacitor
$$i_C = C \dfrac{dv_C}{dt}$$
But specifying that an "uncharged capacitor C is connected to a battery with potential V" is equivalent to specifying
$$v_C(t) = Vu(t)$$
But this is equivalent to specifying
$$i_C(t) = CV\delta(t)$$
which certainly ejects this problem outside of the realm of ideal circuit theory.
Now, there is an easy remedy for this - place a resistor in series with the capacitor and then the capacitor voltage becomes
$$v_C(t) = V(1 - e^{-\frac{t}{RC}})u(t)$$
and the current is finite
$$i_C(t) = \frac{V}{R}e^{-\frac{t}{RC}}u(t)$$
Now, it is straightforward to show that the energy stored in the fully charged capacitor is less than the energy supplied by the battery with the difference being the energy dissipated by the series resistor.
Finally, $R$ cannot be reduced to zero - one can show that there is a fundamental radiation resistance associated with the circuit such that energy from the battery can be radiated away during charging.
My question is: What is the work done by the the battery?
When the polarity is reversed, the capacitor will initially discharge, doing work on the battery, until fully discharged and then the battery will again begin doing work on the capacitor.
Since there is loss during the charging / discharging process, one cannot equate the work done by the battery to the work done on the capacitor.
Perhaps the problem is to be solved assuming that the capacitor
connected to a battery gets approximately a charge CV(in negligible
time).
Including a series resistor allows one to compute the energy dissipated by the resistor which turns out to be independent of the resistance and equal to
$$W_R = \frac{CV^2}{2}$$
Let us first consider a capacitor that is charged and not connected to a battery or other electric power source.
I think you need to take into account that the Electric field in the capacitor is reduced by inserting the dielectric and also the voltage drops between the plates by inserting the capacitor. The dielectric is pulled in to the cap as the capacitor loses electrical potential energy as its voltage is decrease.
The dielectric in the capacity gets polarized so that the surface of the dielectric facing the positively charged plate becomes negatively charged and the surface of the dielectric facing the negatively charged plate becomes positvely charged. The charges on each side of the dielectric are less than the charges on the plates. Overall the electric field inside the capacitor (inside the dielectric) is reduced because the effective total charge on each side of it is reduced.
The electric field inside the capacitor $E'$ is reduced by
$E'={1 \over k} E~~~~~$ or $~~~~~E'={1 \over \epsilon_r} E$
The reduction in electric field comes with a reduction in the potential between the two plates so the energy stored in the capacitor is reduced as the same ammount of charge is stored in it, but the voltage is now lower - so that if it is discharged the power term $VI$ would be smaller as $V$ is lower.
If the battery is still attached then as the dielectric is inserted the capacitance is increased and the capacitor charges up more. The charge is multiplied by dielectric constant, $k$, and then the battery supplies the extra charge and so it loses energy.
As the battery is attached the electric field inside the dielectric is the same as the original electic field in between the plates without the dielectric, but now the charge is higher on the plates and there is again charge induced on the surfaces of the two dielectrics. I think the upper of the two diagrams in the question is correct because the electric field in the gap is the same whether with and without the dielectric inserted.
There will be addition charge density on the plates in regions II and III, but these will be balanced by the extra opposite charges on the surface of the dielectric in II and III so that the upper diagram is correct.
Best Answer
As an answer to your second question.
If you released the dielectric it would reach the equilibrium position and then overshoot as it would have kinetic energy eventually stopping on the other side and then returning.
Compare this with the oscillation of a spring-mass system.
So the dielectric would undergo oscillatory motion and if damped it would eventually stop at the equilibrium position with some of the energy supplied by the battery dissipated as heat and the rest stored in the capacitor.