this might be worth reading.
the "borrowing" most of the time, is done by your broker "behind the scenes", although some (very) sophisticated investors can arrange it off-exchange themselves, but doing so is beyond the means of most regular retail investors.
some securites are "hard to borrow"; dealers are supposed to have found enough to lend you *before* they finalize the transaction.
in the US, the SEC calls this the "locate" rule.
Canadian info here.
obligatory Wikipedia link here.
GLAL,
R.