The main variables are the annual cash flow amount and a “discount rate” which is the interest rate you would earn at equivalent risk.
Each year’s cash flow is divided by (1 + i)^n where I is the interest rate, and n is the number of years out.
For example, 10 years of future annual recurring revenue of $100mm per year, at a discount rate of 5%, has a net present value of $772mm.
That 10th year’s $100mm is only worth $61.4mm in present value based on the 5% interest rate. It is the same thing as saying: $61.4mm invested at 5% would turn into $100mm in 10 years.
If Apple’s net profit turned into a steady $50b stream from here on out, at a 5% discount rate, it comes to a NPV of $673b over the next 20 years. Their current market cap is $680b by the way.