A notary public is an official appointed position by the Secretary of State's office in a given state. As with most public officials, the State requires that the individual get a surety bond prior to getting their commission. This bond "makes sure" that if the official violates the public good through neglect of their responsibilities, funds are available to indemnify the State for its loss.
The main duty of a notary public is to ensure that the individual parties to a contract are who they say they are. The State might suffer a loss if the notary neglects to correctly validate the identity of both parties.
As a public official, the notary public harms the public good by failing in their duty to validate identity. If a Texas notary public doesn't confirm identity and a loss occurs, an injured party can file a claim with that State for the loss, since the State was negligent through its appointed notary.
A surety bond is a guarantee of payment to the obligee (the State) if losses occur for a penalty amount of the bond. Notary Public bonds are generally provided by a surety company (typically an insurance carrier). The bond generally runs concurrently with the term of the notary's commission.
You may be familiar with a car insurance policy. When you have an auto insurance in Indiana claim, the insurance carrier pays the claim and writes off the loss. You aren't asked to pay back the company for the loss. Unlike an auto insurance policy however, a notary bond is simply a promise that the funds will be available if a loss occur. The surety (insurance carrier) pays the State up to the limit of the bond. However, this loss paid by the surety is not simply written off. The carrier will most likely seek reimbursement from the bonded party, the notary themself.
A notary bond protects the public. Who protects the notary? Insurance coverage is available to provide this protection – it's called Notary Public Errors and Omissions and can also be obtained for a nominal fee from insurance companies.