Asylum allows a person inside the United States to claim persecution or fear of persecution in order to gain residency in the US.
1. Person is currently in the US or at a US Port of Entry
2. Persecuted or fear of persecution on the basis of religion, race, nationality, political opinion, or membership in a social group
Tell the officer at the Port of Entry (border or airport) that you fear returning to your home country, and as to apply for asylum.
You will most likely be put in a detention center, and await a hearing with a USCIS Asylum Officer. If they believe you, you will get the chance to apply. If not, you will be deported (you may appeal to an immigration judge).
People who apply for Asylum from within the United States have a bit more leniency. They can begin the application process up until a year of them entering the country.
You will fill out Form I-589 (the main application form), an Affidavit, and documents/evidence proving your fear of persecution. These forms will be sent in to the US Citizenship and Immigration Services.
If the USCIS accepts your case, you will get an interview with the Asylum Office in which you can get asylum. If your case is rejected, you may go to an immigration court, and continue to appeal from the Board of Immigration Appeals to the Supreme Court if things go wrong.