An Energy Vampire (aka a NOS) at it's base removes capacitor energy from the target ship and adds it to your own. But it only works if the enemy has more cap than you do, in terms of percentage. I.e. if you have 10% of your cap left, and your target has 50%, then every cycle of the NOS will transfer some of the targets cap to your own. If you have %90 cap, and your enemy has %50 cap, then no energy will be transferred, but the NOS will still cycle.
Every cycle makes the measurement of cap levels again, and cycles that don't actually transfer any cap, don't actually use any of your own cap either, so usually people just leave it on Auto-repeat and keep it going the entire time they are within range. It will only turn off if you go out of range.
So what does this mean in reality? Basically there are usually a few places where you see this used (and this doesn't cover all uses, just some of the most common I've seen) :
A ship that uses modules that rely on relatively large amounts of cap and is not cap stable without it. The NOS will be used to keep stuff going as much as possible, longer than it might have been able to without one. Examples of these modules are probably most commonly Armor Repairers, but to a lesser extent might also be MicroWarp Drives, Shield Boosters, Afterburners, Warp Disrupters. Probably others as well. Usually the tactics with such ships are to burn in close and run the repairer enough to mitigate enough damage to turn the fight in your favour. When the repairer runs your cap low, the NOS will be sucking cap back from your target that you can use to run the armor repairer.
A ship that wants some defense against Neutralisers. A Neutraliser in the right situation could remove all your cap, leaving you without the ability to run your own warp disruptor, scrambler, webber or other active modules. Usually this means it will either give them a lot easier time to escape, or it might even shut down your active resistance modules like Invulnerability Fields, making you easier to kill. Having a NOS might give you enough cap back to still run the essential modules you need even under neutraliser pressure.
PvE fits where you expect to have rats close up a lot of the time. Because of how NPC AI works, they often act as though they are at 100% capacitor all the time, so when you use a NOS on them, they will always transfer cap to you. This means you might be able to swap a Cap Recharging module or two out for something more useful if you are using a NOS.