Ooh - fun question! I'm looking forward to hearing what others have to say. I do have real experience, as in I'm lending my shares out, and I've been reading and learning about the process. I wouldn't say it's extensive or I'm an authority - this is 2 months now I've been participating.
There are 4 parties involved in the lending of shares. I will call them the share lender, their brokerage, the share borrower (who is selling the shares they borrow), and an escrow bank that holds collateral (for a fully paid lending program). In reality, I suspect that brokerages loan shares to each other, so that an IB customer can borrow shares from a Fidelity customer. For my purposes, the IB-Fidelity (for example) lending of shares is ignored.
As the share owner, my counter party is my brokerage, to whom I lend my shares to. The risk I am taking on is that my brokerage will be unable to return my shares on demand (or my sale of the shares). Strictly speaking, the way I understand it, I am not taking on direct risk that the person establishing the short position will be unable to perform - the brokerage is taking on that risk. Indirectly of course, I have that risk.
Performance means that the brokerage returns my shares to me when I stop lending them out (it's a demand loan, and I can call it anytime I care to). The brokerage returns shares to me - they don't need to be "my" shares, and I believe typically, that's exactly what happens. The brokerage has some big or small pool of shares, so the easy answer if I demand my shares back is to get them from the pool they have.
The real risk in the system is being managed by the brokerage. They lend out the shares they borrow, and charge the borrower of the shares an interest rate. The brokerage also collects cash collateral equal to the value of the shares lent out, and deposits that collateral with the escrow bank (4th party). That collateral is in the name of the share lender, and is there for the specific circumstance in which the brokerage CAN NOT acquire the shares demanded and return them. This is a default on the demand loan by the brokerage, and of course they want to avoid defaulting in the worst way (it looks a lot like a need for bankruptcy protection). The collateral held by the escrow bank is equal to the value of the shares at the close of market yesterday (last trading day), thus limiting the share lender's risk to selling their shares at yesterday's closing price (leading to tax consequences, and other possible consequences associated with selling one's shares when you didn't want to).
To help the brokerage from defaulting, the brokerage has immense powers over the share borrower's account (margin account - read your margin account agreement closely to see all that can be done on your behalf to respond to a margin call). The brokerage also establishes the solvency of the share borrower by keeping collateral in escrow equal to what's been borrowed (at least for TSLA).
You asked about risk across institutions. My impression from reading IB and Fidelity documentation, is that IB is less of a risk based solely on their processes and procedures. It is also my belief that it's not a big difference. In particular, I get the impression that IB is aggressive in their margin calls related to TSLA (or any hard to borrow shares) borrowed shares, with margin calls happening midday and being acted on immediately. As a share lender, I would want my counter party to be aggressive about maintaining adequate collateral, and not allowing a position to get too far out of balance. I'm thinking of a BIG move up in the stock within a single day.
My impression of Fidelity is they're more of a daily update outfit. Both are equal, if my view is accurate, in a flattish or steadily changing market. But if we get into a world where a 6% move up in a day is a disappointingly small move (think TSLA's big run from 30 to 190), then that could be a problem. Then again, Fidelity isn't going to risk their whole enterprise because a short is out of balance and let anybody get too far behind.
Back to risk, I figure that in the worst case, if Fidelity / IB aren't risking their own solvency by doing so, they will use their own funds to find shares and return them before returning collateral (probably including using the collateral first, and then their own company funds), in order to avoid a default to a share lender. That's completely a guess on my part, but I believe it represents good business considering their business is trust - trust on the part of the people who's money and securities they hold, that they will get them back on demand.
Really, this is all the result of my own reading, and then putting this together into a mental structure that is consistent with what I've read, witnessed, and that makes logical sense to me. I can be wrong in important ways about details and big stuff, and I'm looking forward to getting other perspectives.
My net result - I view my lent out shares, at the scale I'm operating at, to be as safe as lending money to Fidelity. Again at my scale, I know that's riskier than lending money to the US Government, but the difference is small enough that they round off to the same thing. That doesn't mean that I'm right - only that it's how I view it.
If I were a share holder in the millions of shares and lending them out, then I would consider lending shares to be dramatically more risky than lending money to the US Govt. But that's because at 1.5M shares, I'd be lending out 1% of the company, and that's a lot of company ownership to find on short notice if required. I'm more like .0001% of the company, and that's not enough shares to move the share price noticeably in a 5 minute trading window.
My risk is the great meltup happening all within a single trading day, enough shorts receive margin calls during that meltup day that can't be met, and Fidelity can only satisfy my loan using the collateral. As long as the meltup happens over weeks instead of days, I think I'm fine.