The answer varies depending on brokerage, legal jurisdiction, and your account status(es). I wasn't able to find good English-language information on Swedish consumer financial regulation, and I suspect this particular concern is not one that is asked regularly.
That said, the following rules of thumb for American brokerages might be of interest:
* Securities held in cash accounts are not loaned out without the customer's approval. Brokers may offer a revenue-sharing agreement, for example IBKR's "Stock Yield Enhancement Program" at https://www.interactivebrokers.com/en/index.php?f=46942>.
* Margin account agreements usually have wording allowing the broker to loan out securities held on margin. This is important for holders of dividend-producing equities in a margin account, because taxation of "payments in lieu" is different from that of qualified dividends.
* In both cases, loaned securities are covered by cash collateral. The exact percentage varies between brokers; as one data point, IBKR collateralizes the loan at 102% [0].
* Retail brokerages have insurance on the first $500k USD of assets per account, including $250k of cash, through the SIPC[1]. This is designed to protect customer assets if your brokerage enters liquidation, and although it doesn't protect loaned shares, it does protect your retail account from being impaired by another customer's short going wrong.
[0] https://gdcdyn.interactivebrokers.com/Universal/servlet/Regi...
[1] https://en.wikipedia.org/wiki/Securities_Investor_Protection...