According to this article, Force Lightning can be used to dispatch foes non lethally. Of course, we've seen people survive force lightning before, but as the person casting it, how sure can you be that your victim will survive?
Force lightning could be lethal or non-lethal, depending upon the goal of Force user. As a Force power, it is the same as all of the other Force powers insofar as it is an expression of a Force user's knowledge of and control over the Force, manifested as any number of effects, in this case discharging electricity (where the electricity actually comes from is another matter) towards a particular target. As with any other Force power, it is learned and practiced, and part of this learning is how to use it precisely.
The ability to use a Force power precisely can be shown in Force telekinesis, where its user can use it destructively or not depending on what they want to accomplish:
a) Darth Vader uses Force telekinesis to snatch Han Solo's DL-44 blaster out of his hands on Cloud City, without destroying it (TESB)
b) Darth Vader uses Force telekinesis over a long distance to choke Admiral Ozzel to death (TESB)
Force lightning under control
Force lightning was used, primarily (though not always) by the Sith, and while there are numerous examples in Legends of it being used to kill, it could also just be used to intentionally torture their target. Examples of a Sith using Force lightning only to torture their targets can be found in the Canon:
in this youtube clip from TCW 3x14 where Count Dooku is using it to train Savage Opress
in this youtube clip, also from TCW 3x14, where Dooku uses Force lightning to punish Savage Opress and then as a weapon during the battle
in this youtube clip from TCW 5x16 involving Darth Sidious and Maul
in its most famous example, when Darth Sidious uses it to slowly torture Luke Skywalker (though planning on it eventually killing him) in ROTJ, before unleashing a far more powerful blast at Darth Vader in his death throes (as it were)
These examples illustrate that Sith possessed the ability to use Force lightning only to inflict pain, not death, upon their target, if they so wished, and there are numerous more examples, usually from Legends stories involving the Sith.
A slightly different example of a Sith using Force lightning under control, from Legends, is Galen Marek/Starkiller from TFU games using it to activate or short out engines and blow up ammunition, as well as performing feats like directing Force lightning through his lightsaber and using it against multiple opponents simultaneously. The Wookieepedia page on Force lightning also illustrates many different variations on Force lightning that were used.
In order to use Force lightning, like any other Force-based power, it required practice and control, and an understanding of the Force itself. When Force lightning is used under control to achieve a specific object, this indicates that not only can it be controlled, but that control over it is learned through the Force.
The above examples, along with an understanding of what the Force is and how using the Force is necessary to generate and sustain Force lightning, indicate that in-universe, in Canon and in Legends, there is evidence that Force users (usually Sith) demonstrated the ability to attune their Force lightning attacks as desired, to be lethal, or not. That they demonstrated the use of this power to achieve specific goals indicates that they possessed the confidence, and therefore the ability, to do so.
N.B. As far as the physics of how they control it, if Force lightning is just electricity, and the Canon seems to suggest so, and the Sith know how to use it lethally or non-lethally, a technical explanation for how they actually accomplish it may be found in things like non-lethal lightning strikes, and in Tasers, where the distinction between volts, amps and watts comes into play, but someone who knows more about electricity than I should comment on that. The first comment below, by Null, links to a discussion about Force lightning as electricity.
Luke may have survived Palpatine's lightning attack, but Anakin definitely didn't, and Luke hadn't inflicted any lethal blows to his father.
It may break down to Darth Vader's armour and electric components, or even his prostheses as electric conductors. (which leads to the question, why don't Jedi wear wooden shoes to neutralize force lightning?).
In my opinion, it clearly depends on the voltage used, which may boil down to the users proficiency with the Force, or the capacity to 'decide' the level of voltage. Considering Palpatine's power, he shouldn't have had problems using it at its maximum capacity. So he either was toying with Luke, and then turned the amps up when Darth Vader surprise attacked him, or force lightning just isn't normally powerful enough to kill. Considering we even get to see Mace Windu's skeleton, I doubt that is the case.
Also, Force users have the capacity to use Force shields. The argument is pertinent to Jedi being attacked with Force Push or Strangle, and being able to shield against it. The proficiency with the Force of the two users involved should determine the outcome explaining why, in some cases, a Jedi should be a victim of Force Push and Strangle, a bit like Force Persuasion. Following this logic, we can assume that a Jedi can shield from Force Lightning, or at least partially, thus reducing the damage. This would explain Luke surviving it (maybe shielding his heart?) and ties in with Vader not being able to defend from Force Lightning as famously known.
Having said all this (and considering that birds can sit on high voltage without being electrocuted) just google anything about surviving electricity (https://www.thenakedscientists.com/forum/index.php?topic=33130.0) all jedi are either total idiots (for not wearing rubber/wood/insulated shoes) or the normal laws of physics don t work in the sw galaxy (M theory suggests some laws of physics may be different in different multiverses).
Also another way of totally avoiding force lighting is levitation, and while we never saw propper levitation in canon we do see force users jump very high (eluding gravity briefly). Thus why yoda would expend immense energies to absorb palpatines attack instead of just levitating or jumping very high is beyond me.
I dont think theres any way to give fl a scientific explaination. Is just fiction and should be seen as such, there isnt much point in questioning weather it would be possible because its just aa double negatory. Even asuming u could use the force in our reality fl doesnt follow any laws of physics. Just to further this point. Even a non force user can protect himself from fl by carrying with him something that attracts electricity to throw nearby when attacked and which would capture all electricty. You might not be aware that roofs of most building have lightning deflectors.
In short fl is just fantasy and should be seen as such.