When installing a 700-18/23C tube, does the nut on the valve stem go inside the tire (unseen once the tire is on the wheel rim) or outside the rim (so it is seen among the spokes)?
It goes outside the rim, where you can see it.
It's not even strictly necessary. It really only exists to keep the valve stem in place while you air the tire up, which makes the whole process much easier. Weight weenies throw them away to save a couple grams.
Also note that if you use it, you don't want to screw it down too tight. Doing so can crimp your tube in the valve hole, causing it to puncture. Screw it on just enough to get the pump nozzle onto the valve. That's all you need. If airing the tire up exposes more of the valve, go ahead and screw it down until it just touches the rim.
PS: The tube size is actually irrelevant. The installation is the same for any tube with a Presta valve.