Numerous proteins are synthesized inside the cell for various activities and these proteins are to be sorted out and targeted to the correct location for proper functioning of the cell and the process is called Protein Sorting or Protein targeting (Similar to that of functioning of a post office).
Proteins that are to be secreted outside of the eukaryotic cell (secretory proteins) are synthesized by ribosomes bound to RER. Secretory proteins have an N-terminal signal peptide which targets the proteins to be synthesized on RER. Similarly proteins destined to reach ER are addressed using a C terminal amino acid sequence (KDEL). Lysosomal proteins are identified by the presence of mannose -6-phosphate addition to that protein.
In short, Golgi apparatus the sorting centre of cell (like a post office) will identify the signal sequences associated with each protein and target it to correct location (signal sequence is the address that helps the protein to reach the correct location).