All of that stuff is based on the arbitrage principle of pricing a forward. If you buy an asset forward, the corresponding arbitrage transaction is to sell the asset spot and lend the proceeds at the risk free rate.
The price of the forward should therefore be equal to the spot price (which you lent as prcinciple) and the interest earned over the period leading up to the forward purchase.
Forward Price = Spot Price (1 + Rf) ^ n
Buying the forward closes out the position at zero profit. So:
Short Spot + Long Rf Bond (Lending) + Long Forward = 0.
Rearranging the above formula allows you to create all sorts of synthetic positions. So to create a long risk free bond synthetically from an equity portfolio you just have to sell it forward, which earns the risk free rate and removes equity exposure without actually selling the underlying shares.
In your second question, just move the short spot to the right hand side. You might currently have cash only, but buying an index futures allows you to equitize that cash … meaning you are now committed to buy the index at some future date which gives you synthetic equity exposure.