(covers information from several alternate timelines)
Engineering, main engineering, or the engine room (the reactor pit in Klingonese), was the location from which the ship's main power systems were controlled. Engineering was the primary assignment of engineers and chief engineers.
In the late 20th century, nuclear vessels of the United States Navy designated their engine room as the main machine room, or MMR. A ship, like the aircraft carrier USS Enterprise, had at least four main machine rooms. Each of these rooms had a nuclear fission reactor. (Star Trek IV: The Voyage Home)
Engineering's primary purpose was to be the central point for control of all engineering systems aboard a starship, especially those related to propulsion and power generation. The matter/antimatter reaction chamber (also known as the warp core) was located in engineering.
22nd century design Edit
NX-class starships of the 22nd century were the first Human vehicles to carry a warp reactor capable of speeds up to warp 5. (ENT: "Broken Bow") Aboard an NX-class ship, a section of engineering was situated on E Deck. (ENT: "Zero Hour")
23rd century design Edit
On the original Constitution-class starships, engineering was a two-deck-tall room that housed the main dilithium reactor and the engineering core as well as a large transparent grill that overlooked power conduits. The room was extensively refitted on Constitution-class starships in the late 2260s to include additional computers, offices, and rooms around the main area. (TOS: "The Corbomite Maneuver", "The Naked Time", "The Conscience of the King", "The Ultimate Computer", "Mirror, Mirror", "Day of the Dove") Parts of the Constitution-class engineering were on B deck, deck 3, and deck 5. (TOS: "Court Martial", "Where No Man Has Gone Before", "The Corbomite Maneuver")
Towards the end of the 23rd century, the engineering department on refit Constitution-class starships was drastically changed, spanning multiple decks. The uppermost level served as the structural support strong back of the ship, and was the anchoring framework for the connecting dorsal and the warp nacelle pylons.
On the forward end of this level was the engineering computer monitoring room, which encircled the intermix shaft and opened, to the rear, into the engineering computer bay. The rear bulkhead of the computer bay contained an emergency section door which lowered to the deck below, and separated the warp engine room from the extended horizontal intermix area; the door dropped automatically in the event of a radiation leak or pressure loss.
On the Constitution-class ship, a narrow corridor bypassed the computer bay on the port side and led aft, down the center of the level. On either side of this passageway were mounted the four maneuvering thrusters which rested beneath the upper hull of the secondary hull strong back. These thrusters were used for vessel course control when within close proximity of drydock facilities.
The lower engineering deck typically housed the engineering department. Located in the center of the room, and extending for many levels both above and below the deck, was the vertical linear intermix chamber.
This complex, a radically new design in intermix technology, provided operational power for the impulse drive system and furnished enough additional energy to power all other shipboard systems. Both matter and antimatter for this chamber were contained in a series of magnetic bottles, which were normally housed in pods at the base of the intermix shaft. These pods could be ejected from the ship in case of an extreme emergency via two large blow-away panels in the outer hull. (Star Trek: The Motion Picture)
24th century design Edit
The corridor bulkhead housed the master systems display. Inside the main section, the master systems display was the operational focus of the room.
Beyond this, heading towards the warp core, the chief engineer's office and several support consoles were located on the left, and the assistant chief engineer's console on the right. These formed part of the bulkhead protecting the main part of engineering from the warp core.
The main engineering systems of the Defiant class were comprised of an upper and lower system aboard decks 1 and 2, with the warp core proper being placed opposite the control consoles on an elevated platform in the center of the area. (DS9: "The Adversary")
The main engineering section of the Intrepid class featured two levels. The lower of the two levels featured the chief engineer's office, a large monitoring area, and space for monitoring and analysis of the propulsion systems, with the second tier featuring a large catwalk ringing around the entire room. (VOY: "Caretaker")
The original Enterprise main engineering set was built on Desilu Stage 9 at Desilu's main Gower Street studio lot. The set included a forced perspective section, depicting the large power conduits going into the distance. This part could be illumninated by lights placed behind the set, creating the illusion of the power conduits pulsating of energy. The set was concieved for, and made its first appearance in TOS: "The Enemy Within". During the early development of that episode, the area was called the "power plant".
In the first season, engineering was depicted as an abandoned place, mostly lacking in people and activity. This aspect was included in the plot of several episodes: in "The Enemy Within", the evil duplicate of Kirk uses engineering as a hideout. Benjamin Finney does the same in "Court Martial". In "The Conscience of the King", Kevin Riley is demoted to engineering duty by Kirk, in order to hide him from a potential killer.
From the second season onwards, the set was heavy updated, and the function of main engineering was revised. It was now buzzing with activity, and filled with people. The emergency manual monitor room extension was added to the set, built on stilts, overlooking the engineering. The refitted engineering set made its debut in "The Changeling".
The engineering set was occasionally redressed to serve as other, temporary sets, such as the ship's theater in "The Conscience of the King", and the Starbase 11 computer center in "The Menagerie, Part I". It also depicted the main engineering of the ISS Enterprise in "Mirror, Mirror", the USS Constellation in "The Doomsday Machine", the USS Exeter in "The Omega Glory", and the USS Defiant in "The Tholian Web".
The Galaxy-class engineering set was on Paramount Stage 9 and was reused from several of the Star Trek films, though many of its components were repainted and its spaces were enlarged. One addition to the set was the table used as the central console which, during production of The Next Generation, was affectionately known as the "pool table." It was previously used as a console in Star Trek IV: The Voyage Home in Starfleet Command, San Francisco. Similarly, the back wall of the chief engineer's office had previously served as an office wall in sickbay aboard the movie USS Enterprise. (Star Trek: The Next Generation Companion 3rd ed., pp. 9–10)
The wall-size okudagram in engineering of the USS Enterprise-D reveals such secrets as the location of the ship's giant mouse, the giant duck, and what might be Gene Roddenberry's World War II bomber.|In TNG: "Encounter at Farpoint", engineering consisted of three levels instead of only two. Crew members were shown working on levels both above and below the reaction chamber during the first shot of the ship's interior.
In the script of ENT pilot episode "Broken Bow", the NX-class engineering was described thus; "Unlike the spacious, brightly-lit engine rooms of future starships, this is more like the cramped, red-lit nerve center of a nuclear submarine."  When it came time to decide how the NX-class engineering should look, Production Designer Herman Zimmerman was instructed to make the area a busy place with many moving components. (Broken Bow, paperback ed., p. 268) He gave John Eaves the directive of designing the engine room so it would look cramped and functional, Zimmerman having recently returned from a visit to a submarine where he could do some research in preparation for tackling the NX-class. "So he was saying, 'We want it really cramped, really tight,'" Eaves reflected. (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
At one point, the engine room was planned to be lit extremely red, inspired by how the torpedo rooms aboard old submarines are sometimes illuminated. "They thought that might be a neat look," John Eaves recollected, referring to the producers' viewpoint, "but it was just far too red, so they toned it back down." (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
John Eaves set to work on designing the NX-class engine room by illustrating some initial concept artwork. From the beginning, the room was intended to feature walkways. "On the early drawings you can see little overhangs – those were going to be the walkways; we were going to put chains in so you could walk up there," explained Eaves. "It was going to be a very crude, very dark room." (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
John Eaves found he had to slightly rework how he first envisioned the engine room, which featured an inset window where workers could view the warp core. "The first drawing was too high-tech looking [....] The way the architecture looked was a little too far into the future," Eaves commented. "This was the first set Herman had me do, and we still hadn't established what the look was going to be. Mr. Berman said it was a little too advanced, and to go back and make it a little more crude." (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
Because John Eaves was meanwhile assuming the NX-class would have a secondary hull like the Constitution-class, his second drawing of the NX-class engineering included a curved ceiling which would have clearly shown the room was located at the top of that part of the ship. The visual concept of a curved ceiling was discarded when it became clear the NX-class wouldn't have a substantial engineering hull. (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
At one stage, the NX-class engineering was considered to include "openable doors," behind which the warp core could be accessed. Even without this design feature, the focus of the engine room remained, of course, the engine. (Broken Bow, paperback ed., p. 268) "They put a lot of controls on both walls so it's pretty much controlled from both floors," John Eaves observed. This left some space on the first floor, where Eaves placed large tanks supposedly filled with materials such as deuterium and antimatter. (Star Trek: The Magazine Volume 2, Issue 7, p. 52)
Many of the particulars of the engineering set were made the purview of Star Trek: Enterprise Set Decorator James Mees, who consequently once cited engineering as the set he found "most challenging" of all the sets featured in "Broken Bow". He went on to state, "All the detail work was left to me – the blinking things, all the pipes – and there's not an inch that doesn't have something that does something!" (Star Trek: The Magazine Volume 3, Issue 3, p. 86)
A schematic of the NX-class vessel shows the upper portion of engineering on D-Deck while its lower section was a part of E-Deck. The latter corresponds with a canon reference in "Zero Hour", although Daniels says in "Cold Front" that engineering is on C-Deck. Engineering on Enterprise appears to have an unseen lower level as, in "The Crossing", Trip Tucker takes the lift up from beneath the deck. The scripted scene description for that scene referred to the elevator "rising up from the deck below." In addition, Herman Zimmerman once characterized this lift as "a four-story elevator." (Star Trek: Communicator issue 135, p. 64) The "fourth story" is apparently used in "Daedalus" when, near the end of the episode, T'Pol is climbing the stairs to the upper level to find Tucker while the elevator is descending from above the upper level ceiling, down past the upper level, and out of the scene to the lower level.
Among the set dressings for the NX-class engineering was a junction wall panel which was, in reality, a radio sound mixer echo board. This piece was sold off on the It's A Wrap! sale and auction on eBay. 
Alternate reality infoEdit
The alternate engineering rooms were not built as a set, but were filmed at a Budweiser brewery due to budgetary limitations and showed some very 20th century construction techniques such as riveted steel girders and 'I' beam hoist tracks where elsewhere in the film antigravity lifting devices are clearly shown. (Star Trek - The Art of the Film) Some concept art of the originally envisioned engineering rooms were shown on the DVD: