  Polarization of the cosmic microwave background (CMB) can help probe cosmic
inflation (via primordial $B$ modes) and test parity-violating physics (via
cosmic birefringence), but realizing the potential of these opportunities
requires precise control and mitigation of systematic effects. To this end,
some experiments (including LiteBIRD) will use rotating half-wave plates (HWPs)
as polarization modulators. Ideally, this choice should remove the $1/f$ noise
component in the observed polarization and reduce intensity-to-polarization
leakage, but any real HWP is characterized by non-idealities that, if not
properly treated in the analysis, can lead to new systematics. In this thesis,
after briefly introducing the science case, we discuss the macro steps that
make up any CMB experiment, introduce the HWP, and present a new time-ordered
data (TOD) simulation pipeline tailored to a LiteBIRD-like experiment that
returns TOD and binned maps for realistic beams and HWPs. We show that the
simulation framework can be used to study how the HWP non-idealities affect the
measured cosmic birefringence angle, resulting in a few degrees bias for a
realistic choice of HWP. We also derive analytical formulae to model the
observed temperature and polarization maps and test them against the
simulations. Finally, we present a simple, semi-analytical end-to-end model to
propagate the non-idealities through the macro-steps that make up any CMB
experiment (observation of multi-frequency maps, foreground cleaning, and power
spectra estimation) and compute the HWP-induced bias on the estimated
tensor-to-scalar ratio, $r$, finding that the HWP leads to underestimating $r$.
We also show how gain calibration of the CMB temperature can be used to
partially mitigate the non-idealities' effect and present a set of
recommendations for the HWP design that can help maximize the benefits of gain
calibration. [abridged]
