If you are a foreign-born person currently living within the United States, whether legally or not, a visa is at this point not entirely relevant to you. That's because, in technical terms, a visa is simply a U.S. entry document. It is issued only by an overseas U.S. embassy or consulate, so as to allow someone to come to the United States, present it at the border or port of entry, and be admitted.
But few people understand this narrow meaning of the word "visa." So we're going to assume that there's a broader question being asked here, regarding whether someone who's in the United States on one particular immigration status can extend or change it. We'll look into this issue below, including:
Whether you can renew or extend an existing status in the United States depends on the type of visa you received and entered the U.S. on. Tourists with B-2 visas, for example, are allowed to ask U.S. Citizenship and Immigration Services (USCIS) for a renewal, so long as their status hasn't already expired. (But the request will be denied if USCIS thinks that what the person is really seeking is to live in the United States long-term.)
Many work-based visas can be renewed by USCIS at least once, assuming the employer wants to keep that person on in the same job and is willing to file the appropriate paperwork (again, before the person's status has expired).
People on F-1 student visas don't normally have to worry about renewals or extensions for as long as they continue with the same academic program, unless they graduate or finish their course of study and plan to start a new program, or need more time than was allotted on their original I-20 from the school. That's because students are admitted for "duration of status" (D/S), meaning for the amount of time it takes them to complete their studies. (See How to Extend Your F-1 Student Visa.)
Check on the terms of your current visa, and check your I-94 document for the expiration date of your current permitted stay; or talk to an attorney for details. (See I-94 Date vs. U.S. Visa Expiration Date.)
Most renewals and extensions are applied for on USCIS Form I-539. Again, please note that you will need to apply for your extension or renewal before your permitted stay in the U.S. runs out. In addition, you can be denied a renewal or extension if you have violated the terms of your original visa or committed a crime or security violation while in the United States.
Whether you can change from your current immigration status to another one while in the United States depends on the type of visa you originally received.
For example, many academic students successfully switch to employment-based temporary visas. On the other hand, some visa categories don't allow changes of status to student. Most notably, B-2 tourists can't change status to F-1, unless they were given a notation in their visa that they were coming to the United States as prospective students.
Other visa types that don't allow changes of status at all include fiancée (K-1), crew member (D), aliens in transit with or without a visa (C), J-visa exchange students subject to the two-year home residency requirement, alien witnesses and informants (S), and M-1 vocational students if they're trying to switch to the F-1 student category.
Also, people who entered the United States using the Visa Waiver program or VWP (meaning they came from a country whose citizens aren't required to obtain a U.S. visa for short tourist visits), will not be eligible to change status. In a few cases, however, Visa Waiver entrants can actually adjust status to permanent resident, namely if they are the immediate relative, such as the spouse, parent, or child of a U.S. citizen who is sponsoring them, and they didn't use the visa waiver inappropriately, for the purpose of getting to the United States and applying for a green card while here. (The "normal" way that the U.S. government expects people to apply for permanent residence is overseas, at a U.S. consulate.)
See Applying for an Extension of a U.S. Visa or Change of Status for more on these procedural options.
If you have become eligible for permanent residence (a green card) while in the United States, and you are here on a valid visa, haven't stayed past the date when you were supposed to leave, and haven't violated the visa's terms (such as by working for a U.S. employer without authorization), you will most likely be able to complete the application process within the United States. This is known as adjustment of status.
If your permitted stay has expired and you haven't left the United States, however, you most likely can't apply to adjust status. This doesn't necessarily mean you are not eligible for a green card at all; it just means you can't stay in the United States to apply for it. Exceptions do exist, though, such as for immediate relatives of U.S. citizens (spouses, minor unmarried children, and parents of citizens who are over age 21).
If you are in the United States illegally after having entered the U.S. without inspection, perhaps by crossing the border at an unauthorized point, and you have become eligible for permanent residence (such as through marriage to a U.S. citizen), it's almost certain that you cannot apply to adjust status. This is subject to some narrow exceptions.
The U.S. immigration system is quite complex, and the exact visa or green card options available to you will depend on your circumstances. Find an immigration attorney to discuss the possibilities (and any risks) as soon as possible—before your permitted stay, if any, expires. The attorney might be able to point you toward possibilities you didn't know were available, or help you with the application process.