It generates a modulating field that transmits the reflected light from one side of an object to the other, making a person much harder to notice (but not completely invisible).
Nightkin NPCs can be seen using stealth boy, however, their usage is entirely cosmetic. Unlike the mechanics of traps, the player does not have to make a saving throw in order to spot nightkins. However, if the player uses the stealth boy and begins a fight in a room with locked doors, enemies from other rooms won't be triggered to join the fight.
The following is based on Fallout 2 cut content and has not been confirmed by canon sources.
Oddly, no Stealth Boys appear anywhere in Fallout 2. Even nightkin patrols near Mariposa Military Base do not have any remaining devices. However, it can be found in the game's files and can be add with an inventory editor but if the player uses it, the game will crash.
End of information based on Fallout 2 cut content.
However, it should be noted that it is mentioned by the Chosen One when he spoke to Anna Winslow, saying that she needs to turn her Stealth Boy off.
The following is based on Van Buren and has not been confirmed by canon sources.
The device's back story wasn't developed until Van Buren, the canceled Fallout 3 by Black Isle, where it was spelled as StealthBoy to prevent it from being confused with the "Stealth Boy" playing style.