depending on what country you come from the laws are different. generally speaking it is a law that you declare because of the fact that you can not pay your debt.
Bankruptcy is a one of the legal status of a person or organisation. For more knowledge of legal terms, i suggest a site here with you and hope it's helpful for you to understand it.