It depends on local availability of test supplies, and perhaps on insurance coverage, if you do not want to pay the bill yourself. Some people report being told "the test is free" but then they receive a bill for "processing." Insurance companies may set requirements for conditions under which the costs are covered.
Theoretically, "anyone who wants a test can get a test," but that may not actually happen. Covid testing is usually indicated if you have been exposed (went to a protest or rally )or have a cough or feel ill), or live with/care for a vulnerable individual. Some travelers to some areas need "recent proof of negative Covid test." In my neighborhood you can be tested for any of those reasons.