Edit
ClearAll[f, F, inv, sol]
f[w_?NumericQ] := Im[PolyLog[2, -E^(I*w)]]
F[w_?NumericQ] := NIntegrate[f[t], {t, 0, w}]
inv[w_?NumericQ, wp_?NumericQ] := 0.5*wp^2 + F[w]
ClearAll[solution] ;
Options[solution] = {MaxStepFraction -> 0.005, MaxSteps -> Infinity,
Method -> {"FixedStep",
Method -> {"ImplicitRungeKutta", "DifferenceOrder" -> 10}}} ;
solution[l_, c_, opts : OptionsPattern[]] :=
NDSolve[{wp[x] == w'[x], wp'[x] == -f[w[x]], wp[0] == c,
Mod[Abs[w[0] - w[l]], 2*Pi] == 0}, {w, wp}, {x, 0, l}, opts] /;
c >= 0 ;
solution[l_, c_, opts : OptionsPattern[]] :=
NDSolve[{wp[x] == w'[x], wp'[x] == -f[w[x]], wp[l] == c,
Mod[Abs[w[0] - w[l]], 2*Pi] == 0}, {w, wp}, {x, 0, l}, opts] /;
c < 0 ;
out = solution[5, 0.2] // First;
{wp[0], wp[5]} /. out
Table[inv[w[x], wp[x]] /. out, {x, 0, 5, 1}]
(* {0.2`,0.19999537137167114`} *)
(* \
{-1.6718455006855417`,-1.6718458095149678`,-1.671842921367624`,-1.\
6718458808125778`,-1.6718464107564595`,-1.6718464264002912`} *)
out = solution[5, -0.2] // First;
{wp[0], wp[5]} /. out
Table[inv[w[x], wp[x]] /. out, {x, 0, 5, 1}]
(* {-0.19999537137418164`,-0.2000000000000036`} *)
(* \
{-1.6718464264011181`,-1.671846410757299`,-1.6718458808139036`,-1.\
6718429213688029`,-1.671845809516107`,-1.67184550068668`} *)