How does the Declaration of Independence appeal to contract theory such as that offered by John Locke?
The Declaration of Independence does this by claiming that governments exist by the consent of the governed and that they exist for a specific purpose.
Locke argued that people agree to be ruled by a government so that they can have their fundamental rights protected. He says that they give up some freedoms in exchange for having their rights to life, liberty, and property protected by the government. In essence, they make a contract with the government with those terms.
The Declaration of Independence echoes this idea. It says that government is only legitimate if it has the consent of the people. It also says that the governments are formed to protect the rights that people get from God. If government does not meet these criteria (if it breaks its part of the contract), it can be overthrown and replaced. In this way, the Declaration appeals to Lockean ideas of a social contract between people and the government.