You will, in general, not visit a laboratory directly, but rather a clinic or other testing site which will collect the sample and send it to the lab for you.
As for your specific questions, the answers will vary wildly by location and are constantly changing. In New York City, for instance, anyone who wants one can now get a covid-19 test for free and without an appointment, referral, or health insurance from the city-run clinics, but this is not the case in all jurisdictions. In California, you can look through the state's list of testing sites to see if any near you offer service without a medical referral. You may also want to check out the website of the specific city you're visiting to see if there is further information there.
Note that especially if you are a low-priority testee (i.e., you have no symptoms of illness, no close contacts who are known to have covid-19, and no other urgent medical need for fast results), the time between when you get the test and when it is delivered to you may be unpredictable, especially if you are in an area where the testing infrastructure is currently stressed. While it is often the case that results are delivered in 2–3 days, it would not be wise to make any plans that rely on you getting results in a specific timeframe.