The idea is quit simple, in a strongly acidic solution the nitrates will behave like nitric acid and dissolve copper metal releasing nitrogen dioxide gas. Looking for this gas is a strong indication for the presence of nitrates.
WARNING: these reactions produce toxic nitrogen dioxide gas, this must be performed outside or in a fume hood.
To perform the test, simply mix some of your fertilizer with water to dissolve the nitrates and then mix it with hydrochloric acid. Then add in some copper metal.
The reaction is very slow to start up unless you heat it. A nerdy way of heating it on the spot without using a heater is to add a small ball of aluminum metal, don't use too much or it will go out of control. Stir the mixture as the aluminum dissolves to distribute the heat evenly.
After the mixture is heated, place a glass container over the mixture to keep the gases in. If nitrogen dioxide is forming the distinctive brown nitrogen dioxide will fill the container.
What's happening is that in the highly acidic environment (low pH) provided by the hydrochloric acid the copper is reducing the nitrates to nitrogen dioxide gas. This test is specific to nitrates but only works if you have a very high concentration of nitrates in your sample.
And that's how you can tell if there are nitrates in your fertilizer.
If you want to test for ammonia (in case you have ammonium nitrate) just mix some fertilizer with half as much sodium hydroxide and add a little water to cover it. If it starts bubbling and releasing ammonia gas then it contains ammonia.
Don't smell the gas directly, it's not safe. Instead, hold a wet piece of paper over it for a few moments and then sniff the paper. You'll be able to smell the ammonia without gassing yourself.
Note: Yeah i do know that there are hundreds of better tests for these substances. But this method is the simplest i could find that used stuff you could buy at the hardware/plumbing store.
Also, you can't substitute other metals like aluminum or iron because they will tend to produce colorless hydrogen with out without the presence of nitrates. Copper is the best metal to selectively produce nitrogen dioxide from nitrate (gold also works but you have bigger issues if you're trying to test nitrates using gold...)