Which factors determine the percentage yield in a laboratory preparation?

Experimental preparations of compounds usually follow the standard methodology, i.e.
1. reaction
2. work-up
3. purification

The theoretical yield can be simply calculated froma knowledge of the stoichiometry of the reaction(s) involved in the preparation.  The final percentage yield is calculated from actual yield/theoretical yield x 100%

For example
In the preparation of nitrobenzene by nitration of benzene the nitrating agent (concentrated sulphuric / nitric acid mixture) is added in slight excess to prevent over nitration of the benzene ring. The yield is dependent only on the number moles of benzene used:
C6H6 + NO2+ C6H5NO2 + H+

It may easily be seen that 1 mole of benzene s expected to produce 1 mole of nitrobenzene. However, this is rarely the case.

Any discrepancy bertween theoretical yield and practical results is due to the following causes:

The reaction may not produce a stoichiometric amount of product. This could be due to equilibrium, slow rate, decomposition of reactant, or product, or evaporation. The reactants may also not be 100% pure. A common problem in synthesis is the issue of side-reactions producing an undesired product.

During a work-up which may involve solvent extraction or crystallisation some of the product is invariably discarded.

During the purification stage some of the product may be lost in distillation, or by decomposition, or even evaporation. Some may remain inside the reaction, or purification vessels, filtration systems, chromatographic columns etc etc.

All of the above will lead to a reduced yield.

Higher than expected yield can only be due to the presence of impurities caused by inadequate purification. (assuming that no mathematical errors have been committed).

It just remains to ascertain how such impurities have arrived there.

It is usually because the product still contains solvent, but clearly it could still be mixed with other products or even reactants. It could absorb components from the air such as water vapour or carbon dioxide. The vessel used to collect the product could even be contaminated.