What do locants with prime symbols (e.g. 4’) mean?
4 means the fourth atom and the prime symbol specifies the part of the molecule (one ' means the secondary structure), so 4'-hydroxyacetanilide means you have acetanilide with a hydroxide group on the fourth atom of the secondary structure.
Naming organic compounds works like this:


  
  Find the longest continueous chain of carbon atoms. Called the parent chain this chain establishes the base alkane name for the compound.
  Number the carbon atoms in the parent chain beginning with the end closest to any substituents.
  Using the correct substituent name (methyl, ethyl, chloro,etc.), and the carbon atom number on the parent chain.
  If a particular substituent occurs more than once, use a prefix (di-, tri-, tetra-) to indicate the number of those substituents.
  List the alkyl substituents in alphabetical order.
  


Source: http://intro.chem.okstate.edu/1014/lecture/organic.html

Here are the IUPAC guidelines about the nomenclature of organic compounds:
http://old.iupac.org/reports/provisional/abstract04/BB-prs310305/Chapter1.pdf