Oxygen and nitrogen actually react to form nitric oxide. Following is from Wikipedia:
$$\ce{O2 + N2 ⇄ 2NO}$$
Oxygen react with nitrogen to produce nitrogen(II) oxide. This reaction takes place at the high temperature[about 2000°CThe uncatalyzed endothermic reaction of oxygen (without catalyst$\ce{O2}$) ; 1200-1300°Cand nitrogen (with catalyst)$\ce{N2}$), an overpressure and in the presence of a catalyst. In this reaction, the catalystwhich is can be platinum, manganese(IV) oxide.effected at high temperature (Chemiday$\pu{>2000 °C}$)
In wikipedia article of nitric oxide, it is written that:
The uncatalyzed endothermic reaction of oxygen ($\ce{O2}$) and nitrogen ($\ce{N2}$), which is performed at high temperature (>2000 °C) by lightning has has not been developed into a practical commercial synthesis (see Birkeland–Eyde Birkeland–Eyde process):
$$\ce{N2 + O2 → 2 ·NO}$$
From a thermodynamic perspective, $\ce{·NO}$ is unstable with respect to $\ce{O2}$ and $\ce{N2}$, although this conversion is very slow at ambient temperatures in the absence of a catalyst. Because the heat of formation of $\ce{·NO}$ is endothermic, its synthesis from molecular nitrogen and oxygen requires elevated temperatures above 1000 °C.$$\ce{N2 + O2 -> 2 NO}$$
Why nitrous oxide is not formed can be explained through thermodynamics. For any chemical reaction to take place spontaneously, we look at a factor known as free energy available for that reaction. Gibbs's Free Energy is given by the equation:
$$\mathrm{\Delta G = \Delta H − T\Delta S}$$
The quantity $\ce{\Delta G}$ must be negative for a reaction to take place spontaneously. Now, most of the nitrogen oxides are unstable with respect to molecular nitrogen and molecular oxygen and have a positive value for the Gibbs free energy change of formation. For the reaction $\ce{2N2 + O2 −>2N2O}$, we put the values in the equation and calculate the Gibbs Free energy to confirm that thermodynamicsthis reaction can't take place.
Now coming to our actual reaction, the entropy change is small and positive. From Quora:
For any chemical reaction to take place spontaneously, we look at a factor known as free energy available for that reaction. Gibbs's Free Energy is given by the equation:
$$\ce{\Delta G = \Delta H − T\Delta S}$$ This is one of the most important equations in all of chemistry because it provides information as to whether a particular reaction is spontaneously possible or not.
The quantity $\ce{\Delta G}$ must be negative for a reaction to take place spontaneously. For the reaction $\ce{2N2 + O2 −>2N2O}$, calculating the values of change in enthalpy and temperature times change in entropy for the atmosphere, we see that this reaction can't take place.
$$ \begin{align} \ce{N2 + O2 -> 2NO} & \tag{ΔG_0 = 86.7 kJ/mol}\\ \end{align} $$
The Gibbs free energy change can also relate to the equilibrium constant, K.
Generally$$\mathrm{G = -RT ln K = -5.7 log K~~(in~kJ~at~298 K)}$$
At equilibrium, reactionthat is under thermodynamic control, the concentration of $\ce{NO}$ in the atmosphere should be $\pu{10^-15.5 atm}$ but actual concentrations of $\ce{NO}$ are significantly higher than this (approximately $\pu{10^-10 atm}$).
So, even though thermodynamics says that $\ce{NO}$ is unstable with respect to $\ce{N2}$ and $\ce{O2}$, it doesn't spontaneously break down to those elements. There is a high activation barrier that must be overcome between nitrogenreactants and oxygen producesproducts. Nitric oxide is kinetically stable but thermodynamically unstable.
For more information, please read the $\ce{NO_x}$ which causes air pollutionarticle.
$\ce{NO_x}$ gases are usually produced from the reaction among nitrogen and oxygen during combustion of fuels, such as hydrocarbons, in air; especially at high temperatures, such as occur in car engines.The term $\ce{NO_x}$ is chemistry shorthand for molecules containing one nitrogen and one or more oxygen atom. It is generally not meant to include nitrous oxide ($\ce{N2O}$).
But the reaction doesn't stop here. It proceeds to form more more nitrogen oxides $\ce{NO_x}$. You can continue reading the article for more details.