$${find}\:{the}\:{value}\:{of}\:\:\int_{\mathrm{0}} ^{\infty} \:\:\:\frac{{dx}}{{x}^{\mathrm{2}} −\mathrm{2}\left({cos}\theta\right){x}\:+\mathrm{1}} \\$$
$${let}\:{I}\:=\int_{\mathrm{0}} ^{\infty} \:\:\:\frac{{dx}}{{x}^{\mathrm{2}} −\mathrm{2}{xcos}\theta\:+\mathrm{1}}\:\Rightarrow{I}\:=\int_{\mathrm{0}} ^{\infty} \:\:\frac{{dx}}{{x}^{\mathrm{2}} −\mathrm{2}{xcos}\theta\:+{cos}^{\mathrm{2}} \theta\:+{sin}^{\mathrm{2}} \theta} \\$$$$=\int_{\mathrm{0}} ^{\infty} \:\:\:\:\frac{{dx}}{\left({x}−{cos}\theta\right)^{\mathrm{2}} \:+{sin}^{\mathrm{2}} \theta}\:=_{{x}−{cos}\theta\:=\mid{sin}\theta\mid{u}} \:\:\:\:\int_{−\frac{{cos}\theta}{\mid{sin}\theta\mid}} ^{+\infty} \:\:\frac{\mid{sin}\theta\mid{du}}{{sin}^{\mathrm{2}} \theta\left(\mathrm{1}+{u}^{\mathrm{2}} \right)} \\$$$$=\frac{\mathrm{1}}{\mid{sin}\theta\mid}\left[{arctanu}\right]_{−\frac{{cos}\theta}{\mid{sin}\theta\mid}} ^{+\infty} \:=\frac{\mathrm{1}}{\mid{sin}\theta\mid}\left\{\frac{\pi}{\mathrm{2}}\:+{arctan}\left(\frac{{cos}\theta}{\mid{sin}\theta\mid}\right)\right\} \\$$$${case}\:\mathrm{1}\:\:{sin}\theta>\mathrm{0}\:\Rightarrow{I}\:=\frac{\mathrm{1}}{{sin}\theta}\left\{\frac{\pi}{\mathrm{2}}\:+{arctan}\left(\frac{\mathrm{1}}{{tan}\theta}\right)\right\} \\$$$$=\frac{\mathrm{1}}{{sin}\theta}\left\{\:\frac{\pi}{\mathrm{2}}\:\overset{−} {+}\frac{\pi}{\mathrm{2}}\:−\theta\right\} \\$$$${case}\:\mathrm{2}\:\:{sin}\theta<\mathrm{0}\:\Rightarrow\:{I}\:=−\frac{\mathrm{1}}{{sin}\theta}\left\{\frac{\pi}{\mathrm{2}}\:−{arctan}\left(\frac{{cos}\theta}{{sn}\theta}\right)\right\} \\$$$$=\frac{\mathrm{1}}{{sin}\theta}\left\{−\frac{\pi}{\mathrm{2}}\:\overset{−} {+}\frac{\pi}{\mathrm{2}}\:−\theta\right\} \\$$