Smart Switch Wiring Question: What is the Need for a Neutral Wire? How to Provide One?
Current flows in loops

You know, with an air tool, you only need one hose.  When the tool is done with the air, it can just release it into the air!  Hydraulics could work that way if we were fish.  But since we're not, hydraulic tools need a return line.  

Electrical needs a return line too, and it's even more important because electrical power works on the difference of forces. So the return line has the same force as the supply line, actually (that's why we insulate it and keep it separate from safety ground).  

So a load connects between hot and neutral (in our nomenclature.)

Now a dumb switch is human-powered.  It needs no power of its own.  So a dumb switch simply connects (or does not connect) an always-hot wire to a switched-hot wire.  Those are the 2 wires in the switch loop before you.

So what options do you have? 

Replace the "switch loop" with a /3 cable

The cable run between lamp and switch does not have neutral.  We change that if we have ready access. 

Unlikely, but if it's in conduit with loose individual wires, a white THHN neutral wire can simply be added, and done.   

Generally, pre-2011 wiring will be a /2 cable meaning 2 conductors (black, white) + safety ground.   Change that to a /3 cable which has black, white, red.  You cannot simply toss in a loose single wire, because all related conductors must be in the same cable.  The old cable can be up-cycled to other tasks if it's removed carefully. 

In the /3 wiring, you must use white for neutral (it's not that way now).  Then I advise using black for always-hot, and red for switched-hot (to the lamp). If you do that, the colors will probably match up with your smart switch. 

Select a no-neutral smart switch (leaks through the lamp)

This is the option if you don't have a functional grounding system.  This works the way traditional dimmers work - it relies on the very low resistance of incandescent bulbs to "leak" a small amount of power through the bulb to power itself.  

This won't play well with CFLs or most LEDs, however that can be solved by adding one incandescent bulb, or paralleling a Lutron LUT-MLC "incandescent simulator" into the lamp wiring. 

Select a no-neutral smart switch (that bootlegs ground)

You should never do this on your own. This, plus a trivial wire problem, would render the grounding system itself lethal. Not what you want! 

And this only works if your grounding system is in good order clear back to the panel. 

UL (Underwriters's Laboratories) writes the rules that appliances must follow to be certified as safe.  Under very narrow rules, they allowed smart switches to power themselves by bootlegging the ground wire as a substitute for neutral. The rule limits current to 0.5 milliamps (not harmful if the above happens) and too low to trip GFCIs.

However NFPA (who writes the National Electrical Code) does not like this method, and outlawed it as of NEC 2020 (or to be more precise, outlawed sale of the devices as of Jan 1 2020).  The good news is, only one US state has adopted NEC 2020. So they should still be available, but don't count on that supply to last.