I'm trying to insert a text variable (last page number) in my document but the menu doesn't appear.
Please let us know the version of InDesign? Are you using the latest InDesign version CC 2017.1?
Nonetheless, you can try cleaning both your InDesign cache and preference. https://forums.adobe.com/thread/526990