Methods for synthesis of encoded libraries