At the Battle of Mobile Bay, Adm. David G. Farragut commanded an 18-vessel fleet that included two monitors and his own wooden-hulled flagship, USS Hartford. The entrance to Mobile Bay was guarded by Fort Gaines and Fort Morgan, and between the bay was blocked by pilings and underwater mines -- then called "torpedos." One of the mines had sunk the monitor USS Tecumseh, and the captain of the wooden-hulled USS Brooklyn, which was in the lead of Farragut's fleet, slowed for orders before approaching the minefield. Farragut then allegedly made the famous order that the Hartford's captain "damn the torpedos," and to go ahead through them at full speed. Hartford and most of the other ships passed Brooklyn and went through the mine field without (I believe) any serious mishaps from the mines. What reason did Farragut, if he had any, have to believe that the minefield would not sink his ships? Or did Farragut believe that operating at full speed would help keep the Hartford from blocking the channel to the other ships, even if the mines detonated and sank the flag ship?
He didn't know anything of the sort. He had to make a calculation based on the facts.
Naval mines, then called torpedoes, were dangerous but unreliable, especially the Confederate ones. Although he had just seen the Tecumseh go down, showing that at least one mine was functional, he also knew that the confusion in the line of ships because of the sinking led to his unarmored ships being stationary under fire of the forts. Staying put would mean that ships and men would be lost to gunfire from the forts.
Believing action better than inaction, he risked the torpedoes and losing additional ships to gain entrance into the bay and thus shutting down the port. As it turned out, no other ships were lost although there were reports of sailors hearing the snap of the firing mechanisms.
Once the fleet was inside, the port was lost - unless the Rebel ironclad could defeated his entire fleet. It failed to do this, and soon landings behind the forts led to their evacuation, thus closing down the last Gulf port.
David Farragut was an aggressive commander who sometimes exceeded his orders. In 1863 near Port Hudson, for instance, he had orders to co-ordinate a naval attack with a land based attack. Farragut decided to attack first, to obtain all the glory for the navy, and was defeated when the Confederates could concentrate artillery fire on him without the distraction of a land attack.
Another formative influence was the capture of New Orleans, which he had won by "going through" two enemy forts, and then destroying a large (but inferior) Confederate fleet, leaving the port at the mercy of his ships' guns. At Mobile, the Confederates had both two forts and torpedoes, but on the other hand, its fleet was much smaller than at New Orleans. Farragut coolly figured that while he had two barriers to get past, rather than one, his earlier experience had taught him that he was capable of doing this.
The effect of losses such as the the one sunk ship is psychological, as much as physical. Seldom do armies or navies take losses of as much as 50 percent (except in retreat, after being broken). Farrugut figured correctly that if he could get through the torpedoes and past the forts with "some" losses, what was left would be able to defeat the few remaining Confederate ships and capture the harbor. He was right of course, and the decisive factor in such battles is often the bravery and determination of the commander.
It's not a matter of Farrugut, Nelsono, or any other naval commander "knowing" he can get through. It's called "you pay your money and you take your chances." A good commander (in any environment) will know when to do this.