Based on a Bloomberg article by Matt Levine, this is how it works:
Pension funds have long-term liabilities: say a liability of £100 in 30 years from now. This liability will have a net present value, depending on the prevailing interest rates. Let's assume the discount factor is implied from UK gilts, so the liability is discounted using the yield on the 30-year gilt. Assume the NPV is £50 using the 30-year gilt discounting,
If the fund purchases 30-year guilts that will pay £100 in 30 years (including coupons, etc: for simplicity), there is no issue and these funds are perfectly hedged. As alluded to above, for simplicity, assume the price of these gilts is £50 today.
Pension funds, however, don't have 100% of their assets in bonds: they have a mix of bonds, stocks and other instruments. Suppose the fund put £30 in gilts and £20 in stocks: i.e. the NPV of their assets is £50 today and as stated above, the NPV of their liabilities is also £50.
If rates go down, however, the liability's NPV will go up from the previous value of £50, and this will not be fully compensated by the holding of gilts, as long as the fund also owns some stocks (assume stocks don't move when rates go down). So now, to solve this issue, the fund purchases some IRS, and we can answer your questions:
To protect from the case when rates go down, the fund receives fixed and pays float on an IRS: this is done to neutralize any duration mismatch between the assets and liabilities (stocks have no duration, so if the NPV of 30-year bond assets is £30 and the NPV of 30-year bond liabilities is £50, there is clearly duration miss-match and the fund will want to receive £20 notional of 30-year IRS).
You select the legs to match the duration of the liabilities. In our simplistic case, all liabilities are assumed in 30 years. In reality, there will be liabilities and assets of various maturities, and so the IRS will be chosen across all maturities to neutralize duration in those maturities.
I believe the funds hedge their duration regularly. The term will always be (say) 30-year fixed vs. 30-year float (float paid semiannually most of the time vs. fixed annual): but as rates change, the fund might buy duration one week (i.e. receive fixed IRS) and then sell duration another week (i.e. pay fixed): the hedging happens whenever the duration mismatch becomes material for the fund.
Not sure: someone else answer please.
PS: what seems completely perverse to me is that the IRS hedge described above clearly only protects the fund from rates going down. If the rates move up (as they suddenly did over the past week), the hedge can massively back-fire. If I were the fund, and the rates were near zero, I would never hedge the duration via IRS the way it's been done, it just seems completely ridiculous to me.
I suppose that if the rates increase very gradually, they would gradually unwind their IRS duration hedges, but it still seems costly.