A nacelle was an outboard engine housing structure on spacecraft. The nacelles in warp-capable shuttles and starships housed the warp coils of the vessels warp drive. Warp nacelles were also sometimes known as power nacelles, antimatter nacelles, warp drive pods, or space/warp propulsion units during the 23rd century. (TOS: "The Doomsday Machine", "Bread and Circuses"; TNG: "Datalore") Impulse nacelles of a sublight shuttlecraft housed the ships impulse driver engines. (TNG: "In Theory", "Descent" display graphic)
The warp coils in warp nacelles created a subspace displacement field, which "warped" the space around the vessel allowing it to "ride" on a spatial distortion, and travel faster than the speed of light. (ENT: "Cold Front") While not always present on starships, warp nacelles were the most common component of warp flight, dating as far back as Zefram Cochrane's original warp ship, the Phoenix, circa 2063. (Star Trek: First Contact)
Aboard most warp-capable vessels, warp coils were fed by plasma conduits from the warp core reactor assembly. Venting the plasma from the nacelles made warp drive impossible until the nacelles could be replenished. (ENT: "Civilization") Nacelles were separated from the ship by large pylons, and usually housed a Bussard ramscoop at the fore end, primarily used for collecting hydrogen from space.
On the large Galaxy-class nacelles, the interior included a small control room, accessible in nominal conditions by a Jefferies tube that permitted maintenance and monitoring of the system's operation. (TNG: "Eye of the Beholder") Aboard the prototype NX class Enterprise NX-01 of the 22nd century, a long catwalk spanned the length of each nacelle and, in emergency situations, acted as shelter for the ship's crew against certain types of radiation such as that created by neutronic storms. (ENT: "The Catwalk", "The Crossing") Nacelles aboard Enterprise were required to be polarized for warp travel to be possible. If one of the nacelles were to become depolarized, warp drive would be impossible until repolarization could take place. (ENT: "Fight or Flight")
Most vessels typically had two nacelles. However, such vessels could operate with one nacelle disabled, but at reduced warp speeds. (VOY: "Year of Hell"; ENT: "Twilight") It was not unprecedented, though, for vessels to have had different nacelle configurations. For example, Federation Freedom-class, Saladin-class, Hermes-class, and the Kelvin-type starships had only one nacelle. Federation-class and Niagara-class in the prime reality and Armstrong-type starships in the alternate reality had three nacelles. Constellation-class, Cheyenne-class, and Prometheus-class starships had four nacelles. (Star Trek II: The Wrath of Khan; Star Trek III: The Search for Spock; Star Trek; TNG: "The Battle", "The Best of Both Worlds, Part II"; VOY: "Message in a Bottle")
Even at sublight speeds serious impacts from weapons or other objects could spell disaster for a ship because of a feedback of energy throughout the vessel. The Enterprise-D was destroyed by such an impact in an alternate timeline when the USS Bozeman collided with one of Enterprise's warp nacelles. (TNG: "Cause and Effect")
Some starship classes, such as the Defiant-class and the Steamrunner-class, possessed nacelles that were integrated into the ship's main structure without pylons. (Star Trek: Deep Space Nine; Star Trek: First Contact)
In 2374, the crew of the USS Cortez had difficulty stabilizing the guidance thrusters on their port nacelle, forcing them to fall back from the position they were in as part of the Operation Return fleet. (DS9: "Favor the Bold")
When a class 2 shuttlecraft exceeded the speed of warp 9.7, tritanium depolarization created a velocity differential between the nacelles and fuselage. A depolarization matrix around the fuselage was required to avert the nacelles from tearing off due to subspace torque. (VOY: "Threshold")
The use of the word nacelle in spacecraft design descends from its use for similar housing structures in air and water craft design.
According to Star Trek Blueprints, while the Constitution-class nacelles are powered up, they produce dangerous levels of radiation and crew members are not permitted to go up the jeffries tubes that lead to the nacelles inside the nacelle pylons. 
According to Star Trek: Starship Spotter, there were several different types and designations of warp nacelles officially known as warp drive units. In Federation starships, the original configuration of the Constitution-class and the Delta Flyer-type shuttles featured circumferential warp nacelles. The refit-Constitution-class and Miranda-class featured linear warp nacelles. Later starships featured advanced linear nacelles, where as smaller ships featured compact versions of these. Klingon nacelles were known as dilithium conversion graf units (See: S-2 graf unit) and Romulan nacelles of the D'deridex-class were known as quantum singularity energized warp drive units. The Jem'Hadar attack ships featured ion propulsion units as warp nacelles.
According to the Spaceflight Chronology (page 139), a three-nacelle configuration gives a third more power to the warp drive, greater acceleration and faster engagement. However, in the first experiments, the third nacelle accentuated discrepancies in the warp field causing warp vibrations. This created difficulties in steering, and would have resulted in the ship shaking itself apart at higher warp speeds. It was however noted that if the design was constructed perfectly it was possible for it to deliver what it promised.
The Star Trek: The Next Generation Technical Manual (pages 63, 65, and 66) states that the experiments with single and more than two nacelle designs, conducted in 2269, proved that having two nacelles was the optimal configuration for vessel control and power generation. On Galaxy-class starships, there was an emergency separation system for the nacelles. In the event the ship was damaged and unable to retain a nacelle safely, explosive latches separated the nacelle from the pylon and lifted it up at thirty meters per second. If a nacelle was lost during warp flight, it could tear the ship apart, as the loss would cause different areas of the ship to travel at different warp factors.