There are two basic ways to test soil: buy a home test kit and do it yourself or send a soil sample to a laboratory and have it done professionally. The best answer is to have the pros do it.
A laboratory analysis only runs about $20 for a basic test, but can run much higher if you want to test for specific elements. Generally, a home gardener only needs to know four things about soil: the pH, and the levels of nitrogen, phosphorus, and potassium (or potash). I would recommend a fifth, the level of organic matter. Basic professional testing by a university or private lab should include all of that info plus salinity levels. You can find a list of testing labs at this link to Colorado State University fact sheet 0.520, Selecting an Analytical Laboratory. Results should be send back to you in a few weeks.
A home soil test kit usually costs about half the price and can be done quickly. It will give you the same basic information, but not nearly as accurately as a laboratory test. Most home kits work best for acid soils and are less accurate for alkaline soils, but they'll still give you a basic idea of soil quality. A slightly inaccurate test is better than no test at all.
If you are just starting your garden and have a plot of bare soil, I highly recommend getting a professional soil test. That way you'll know exactly what you need to add to the soil in the way of amendments and fertilizers to prepare it for the type of plants you plan to grow. If your garden is in place and you're just concerned about basic nutrient levels, a home soil test kit will give you an basic, though not precise, idea of what is in your yard.
The basic process for doing a home soil test kit is to combine your soil with distilled water and various chemical tablets in small plastic vials. You'll use different tablets in different vials for different test steps. The water will change color and you compare the color with a chart to determine the respective test result.
Don't expect accurate results. The outcome of my pH test showed it to be somewhere between 6.0 and 7.0, not too extreme. Depending on how you interpret the color, it could be close to either end. That's good enough for most plants, but if you're trying to grow something with specific pH needs you'd be better served by an accurate reading.
Regardless of whether you do it yourself or have it done by the lab experts, get a soil test done. A professional test is advised. It will keep you from guessing about plant problems. It will help you provide appropriate levels of fertilization. It will set a foundation for proper soil amending.
By knowing your soil you are better able to know your garden. Eighty percent of plant problems are soil related. Understand your soil and you have a great advantage in understanding why things go wrong with your plants.