The math behind Customer LTV formula + calculations in R

Probably someone could find useful my posts about understanding the math of LTV and using cohorts approach for calculating it in R. I also want to ask which approaches you used in your work or probably you built some ML models connected with LTV. Please share your experience.