How to type theta as shown below?
Hope image is clear
In unicode-math, this is \muptheta. There are also \mupvartheta, \mupTheta, etc. This has the advantage of matching your math font, which upgreek will not unless you stick to Computer Modern. \symup{\theta} or \uptheta also work.
\documentclass[varwidth]{standalone}
\usepackage{unicode-math}
\begin{document}
\( \cot^2 \uptheta \)
\end{document}
The unicode-math package switches your documents to Unicode fonts and requires LuaLaTeX or XeLaTeX to compile. If you need a PDFLaTeX-compatible document, If you are using a font package, see if it has options to select upright or slanted Greek, or if it supports a \mathrm Greek alphabet. isomath has a command to select upright Greek math alphabets. The Euler font, and in particular the eulerpx, also provide upright Greek.
You can use the upgreek package. See example below.
\documentclass{article}
\usepackage{upgreek}
\begin{document}
cot\textsuperscript{2} \uptheta
\end{document}