When nitrogen and oxygen mix at room temperature under standard atmospheric conditions, nothing happens. In fact, air is comprised of 78 percent nitrogen and 21 percent oxygen. The nitrogen is inert, or inactive.
At much higher temperatures, nitrogen reacts with oxygen to form nitric oxide, but this takes a considerable spark of energy. In the upper atmosphere during a lightning storm, nitrogen and oxygen react and the resulting nitric oxide further reacts with water to form nitric acid. When it rains, this nitric acid is carried down to Earth and forms compounds with other elements. Nitrates and nitrites are a few of the results.