To start with, this is a highly technical issue upon which different jurisdictions may differ, and in which different rules may apply in different circumstances either by agreement or by statute. Also, similar situations are sometimes treated differently in this regard in bankruptcy and out of bankruptcy.
The majority rule is that the lender may choose which remedies - such as collateral and guarantee rights, to enforce, and the lender may choose in which order to enforce them.
For example, most jurisdictions allow a lender to collect from a guarantor even when collateral is available to the lender, in lieu of foreclosing on the collateral.
Sometimes, however, special rules apply.
For example, if the guarantor is a government agency (e.g. the Small Business Administration or the Veteran's Administration), often the lender is required to take all reasonable efforts to collect from the borrower and recover the amount owed from collateral, before the guarantee can be invoked.
Similarly, sometimes the law distinguishes between an accommodation party who receives no consideration in a transaction who signs as a direct debtor, and one who signs in a guarantor capacity. Those jurisdictions may require a good faith effort to collect from direct debtors (often including attempts to foreclose upon collateral) before attempting to collect from guarantors who sign as such.
There are also arrangements, such as credit default swaps or a situation when a consumer provides a credit card payment authorization which a creditor can use in the event of a default (or the large dollar amount equivalent of such an arrangement called a "letter of credit"), in which the line between what constitutes collateral and what constitutes a guarantee can be blurred.