First you set up your math for finding the Net Present Value(NPV). Then you do the calculation with different discount rates or hurdle rates until NPV=0. When NPV=0 then IRR=discount rate.
The formula for IRR is this:
IRR=Discount Rate When NPV=0
The IRR is the discount rate of the NPV when the NPV is equal to 0.