Spectral synthesis techniques for supernovae and kilonovae (Living Reviews in Computational Astrophysics, 2025)