How to do Yield Farming in web3.js? (uniswap, sushiswap)

I'm trying to understand how to do Yield Farming in UniswapV3 SushiSwap. There's MasterChef(3) there which is used for Yield Farming, it's got function deposit(...), .add(), withdraw(...) among others.

(1) What's the algorithm: do I call deposit(), or add(), or both? In what sequence?

(2) Does it Yield or send earned tokens automatically to my address? Or do I have to call a certain function once in a while myself? Which?

(3) How do I take my tokens out whenever I'll decide to get out? Is it withdraw(...) only?