Security agreements are contracts. Article 9 of the Uniform Commercial Code governs security interests in personal property. It has been adopted, with some modifications, by every state. A security agreement must comply with other state laws governing contracts.
Article 9 of the Uniform Commercial Code covers most types of security agreements for personal property that are both consensual and commercial. See § 9-102(2) and § 9-104 of the code. This includes fixtures, personal property that is "fixed" to real property such as a water heater. Statutory liens (e.g. a mechanic's lien) are generally not governed by Article 9 but by the individual statute that creates them.
See §§ 9-102(2) & 9-310 of the code. Article 9 contains a statute of frauds which requires a security agreement to be in writing unless it is pledged. A pledged security agreement arises when the borrower transfers the collateral to the lender in exchange for a loan (e.g., a pawnbroker). The "perfection" of a security agreement allows a secured party to gain priority to the collateral over any third party. To perfect a security agreement, the filing of a public notice is usually required.
Article 9 also provides for the resolution of conflicts if there are multiple security interests or liens on specific collateral. See §§ 9-301 - 9-316 of the code. Part 5 of Article 9 deals with the procedures to be followed when a borrower defaults. See §§ 9-501 - 9-507 of the code.