Just like loaning out money carries risk, does loaning out your stock shares also carry risk?
If the borrower of your shares is short the stock on the ex-dividend date, he pays you the dividend in the form of payment in lieu. Payment in lieu of dividend not tax qualified and the investor must pay the higher regular income tax rate on the amount received (Form 1099-MISC). IOW, you lose your qualified dividend status and its lower tax rate.
The shorter who borrows your shares pays a borrow cost. Some brokers share it with you, the lender, and you can generate some income from lending. This is generally for hard-to-borrow stocks.
Margin is required to take as well as maintain a short position. In the unusual case where the borrower blows up his account and goes negative, it's the borrowing broker's responsibility to make you whole.