assuming you are a beneficiary under a deed of trust, you have the option to foreclose judicially (by filing a lawsuit instituting the foreclosure) or non-judicially (by doing a trustee's sale).
assuming you are a mortgagee under a mortgage, you can only foreeclose judicially.
Most secured parties choose non-judicial foreclosure because it is quicker and easier and less expensive.