Say Bad Guy X is swimming (either half or fully sub-merged) in a pool or fountain or river or sea. Player Y (on dry land) casts Lightning Bolt into the water.
What happens to Bad Guy X?
There are no special rules for how magic electricity interacts with water. The surface of the water acts as cover for those submerged, which prevents targeting them entirely. If someone’s partially above the water, they can be targeted normally, with no special consideration due to the water.
This is actually a fairly reasonable approximation of reality, consistent with the limits of the abstraction thresholds of d20.
Ultimately, the danger of being in water during a thunderstorm is that it increases the likelihood that a natural lightning bolt will affect you. It increases the chance of a direct hit, and it increases the effect of a near miss. That is, assuming you are on, or very near, the surface of the water, because that’s where humans generally are. The effects of a lightning strike do not penetrate very far into a body of water: 20 feet, maybe. So being deeper than that provides protection from lightning (precisely as the rules suggest). But if you are on the surface, the problems are these:
You are more likely to be poking up from a relatively flat surface, with nothing else around you of similar height. Just your head sticking up won’t make much difference, as a stormy sea almost-certainly has waves at least that tall. But a boat might, and a mast definitely will, make a large difference. Natural lightning is more likely to strike something that’s up higher than its surroundings.
Water will conduct the electricity somewhat; this only matters if the water strikes very close to you, but ultimately being in water means you are facing a greater current from a strike near you than someone standing on dry land at the same distance. The difference is not as large as you would think, though: you do not want to be within 20 feet of a lightning strike under any but the most controlled of circumstances (you’re totally fine within inches of a strike if you’re in a Faraday cage, and fun fact: cars, with their metal bodies, are pretty decent approximations of a Faraday cage, so lightning can strike your car right over your head without affecting you).
Water is going to react to the blast itself in ways that are potentially more serious than the ground. Water will boil, and pressure waves will radiate from strike point both as a result of thunder and of the water boiling (which, really, are pretty much the same thing since thunder itself is caused by superheating the air). Thus concussive force and substantial heat is being thrown at your body.
What being in water does not do is change what happens if a lightning bolt hits you, rather than near you. It makes that marginally more likely (but a boat or mast would be massively more significant than just floating in the water), but once it has already happened, it doesn’t really matter where you are. The current and heat and concussions applied to your body are going to be quite similar (and near-certainly fatal) in both cases.
And the reason that all of this is irrelevant is because this is below the abstraction threshold of d20: it happily ignores all of this, and does so consistently:
Lightning bolt is a magic spell, and it objectively does not behave the way regular electricity does. It does not follow the path of least resistance. If it did, and created a large potential at the caster’s fingertips, the lightning would not arc out an enemy, it would quite happily take a path of vastly lower resistance and travel up the caster’s arms, through his chest (probably causing cardiac arrest), down his legs, and into the ground. This, obviously, is not what happens nor what anyone casting the spell wants to happen.
As a result, neither your height relative to your surroundings nor the relative conductivity of your surroundings matter. Thus being in water doesn’t make you more vulnerable to lightning bolt for the exact same reason that having a lightning rod doesn’t protect you from lightning bolt: the magic is forcing the electricity to move in ways it would not naturally.
Lightning bolt only does electricity damage. There is no risk of deafness due to thunder, there is no risk of burns (fire damage?) due to the intense heat, there is no risk of damage from concussive force. Why? Magic. Or because the system is an abstraction that simplifies reality to make it playable. Thus, the fact that a lightning bolt boils water, can create fairly intense pressure waves, and so on, just doesn’t apply to lightning bolt. That eliminates a lot of the increased risk of being in water when lightning strikes.
Lightning bolt deals half damage on a Reflex save, and being in water doesn’t affect one’s reflexes (either through Reflex saves or touch AC). One might expect that it does, but it doesn’t. This is true for anything and everything that might affect dodging or moving out of the say. So lightning bolt is consistent with everything else that allows you to (partially) get out of the way: being in water does not affect things. Even assuming magic electricity that didn’t cause side effects, per the last bullet point, one might expect water to increase the amount of current flowing through someone due to a nearby lightning strike (though the difference is not as large as you would imagine), but this does not happen and that is not surprising because the reason you might expect that is because of the rules that natural electricity obeys. But the magic electricity of lightning bolt does not do that, and in fact the spell would be useless if it did.
For a slightly different twist, I'll start by insulating myself with, in the Core Rulebook, on page 432 under Environment/Wilderness/Aquatic Terrain/Spellcasting Underwater:
Some spells might function differently underwater, subject to GM discretion.
So, while I applaud the logic of @KRyan 's answer, if you're looking for something different, you could try this.
In previous versions, including both 1e and 2e, a lightning bolt underwater discharges as a fireball-like effect, in a 20 foot radius sphere, centered basically where the lightning bolt touches the water. (I say basically, because the rule varies across editions, both in effect and in descriptive detail.)
It's a pretty simple adjudication, easy to implement, and it fits in nicely with our gut intuition of "water conducts electricity" without requiring you to do any calculus.
In real, or rpg?
In real life, lightning will affect a person in water based on:
depth of person
depth of water
size of body of water (pond vs. lake. vs sea)
distance from person to lightning hit.
E.g. if the person is in a small pond or a flooded basement, and the caster casts lightning on the water, I'd rule full damage to everyone in the water. If the person is afloat in the sea and lightning strikes 1,000' away, no damage.
Lightning strikes the ocean on earth nearly continuously, yet people are always in it. Even if the lightning is "nearby", as in you can see it off in the distance, it will not affect you.
RPG's are generally abstractions from real life, to make it less complex, and include magic. The rules for the spell are whatever it states, or whatever the DM/GM states. The above is just to provide some realism to the game for your reference.