A liquidation is a process that occurs when a borrower's Collateral Ratio goes above the liquidation threshold due to their collateral value not properly covering their loan/debt value. This might happen when the collateral decreases in value or the borrowed debt increases in value against each other.
In a liquidation, a portion of a borrower's debt up to the close factor is repaid and that value + liquidation fee is taken from the collateral available, so after a liquidation that amount liquidated from your debt is repaid
The liquidation penalty (or incentive for liquidators) depends on the asset used as collateral.
To avoid liquidation you can raise your Collateral Ratio by depositing more collateral assets or repaying part of your loan. By default, repayments increase your health factor more than deposits. Also, it's important to monitor your Collateral Ratio and keep it low to avoid a liquidation.
Yes, liquidations are open to anyone, but there is a lot of competition. Normally liquidators develop their own solutions and bots to be the first ones liquidating loans to get the liquidation bonus.