How does Stock Lending & Borrowing work?

On a broader level I understand that someone who owns a stock can lending it and make money and the person borrowing shares has to pay interest. But beyond this, how does it work exactly and how much money can stock lender make?