The endoplasmic reticulum is an
organelle that serves different functions for different kinds of cell. It is an extension of the
nuclear membrane, though its internal volume is separate and called the
lumen. That volume is contained in of various
tubules and
vesicles that make up a network between larger sacs, called
cisternae. Some portions of the ER are known as
rough endoplasmic reticulum because they are studded with
ribosomes that make them appear rough under an
electron microscope. Any portion of ER that doesn't have ribosomes embedded in it is called
smooth endoplasmic reticulum. Since these portions are
topologically continuous and serve many of the same functions in the cell, they are considered part of the same
organelle, rather than separate organelles as previously thought.
Unlike a specific organ across all animals, the ER does wildly different things depending on what kind of cell it belongs to. About the most general you can get is that the rough ER makes various enzymes and receptor sites, while the smooth ER synthesizes cell membrane phospholipids, steroids, and other lipids. All cells use the ER for transportation and storage of the various products it synthesizes; much of the lumen volume is simply dedicated to keeping "spare parts" until they are needed.
In pancreatic cells the smooth ER produces insulin; a defect here is responsible for some forms of diabetes. Liver cells have smooth ER which breaks down drugs and toxic chemicals and metabolizes glycogen. Steroidal cells in the gonads use their smooth ER to metabolize intercellular steroids and produce a final hormone. Sections of the rough ER in the gut make digestive enzymes which are encapsulated in vesicles and released through the cell membrane. Leukocytes in the blood and lymphatic systems use their rough ER to synthesize entire antibodies. Unicellular organisms with cilia generate the pores which will grow the cilia in their rough ER.
Ribosomes have an affinity for the rough ER because of special receptor proteins located on it. Once each half of the ribosome has "locked" on to a piece of mRNA, it encounters one of these receptors and settles down on it. Each receptor is "aimed" at a pore in the rough ER, so as the protein is created by the ribosome it is pushed into the lumen. When the ribosome has walked far enough down the strand of mRNA for its head to become loose, another ribosome can attach to it, find an empty receptor, and so forth. A strong electron microscope can see all the individual ribosomes and strands of mRNA snaking along through some of them. During transcription the growing proteins are helped to fold by chaperone proteins inside the lumen. Once transcription is complete, the ribosome breaks into two parts and leaves the receptor.
Proteins to be used in the cell must be further processed in the Golgi apparatus before they become active. Hence, the rough ER always interfaces with the Golgi apparatus while the smooth ER sometimes does not.