I have a U.S. student visa (F1) that is valid until next year. I booked a ticket from Hong Kong to Mexico City, and I will have a layover in Los Angeles for about 5 hours. Although the purpose of my travel isn't to study in the U.S., I do have a valid student visa. Can I still transit in the U.S.?
Your F1 (Student Visa) is only valid if you also have a valid I-20 form signed by the university or college that you are currently enrolled in (or if you have finished your program, are currently working on the practical training (OPT) option of the F1).
If you are in one of these situations, your school should have signed your I-20 before you left the country so that you can return to your studies. If this is the case, the signature is usually valid for one year, and you should be able to transit through the US without trouble.
If you do not have such a document, your F1 visa is essentially useless. If you qualify for the Visa Waiver program, you don't need a visa for transit, otherwise you will need to apply for a visa. See