Why doesn't lineno number a paragraph when it is followed by an indented equation?

For line numbering to be done correctly the math environments has to be wrapped using the \begin{linenomath*} and \end{linenomath*} code:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{lineno}
\linenumbers
\begin{document}
For line numbering to be done correctly the math environments has to be wrapped using the ''linenomath`` code as follows: 

\begin{linenomath*}
    \begin{equation}
        a^2=b^2+c^2
    \end{equation}
\end{linenomath*}
some text here some text here  some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text here some text heresome text here. 
\end{document}

enter image description here


$$...$$ is obsolete, see Why is [ … ] preferable to $$. If you use the correct LaTeX displayed math environment, the numbering works without the empty line:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{lineno}
\linenumbers
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit: 
\[1+1=2\] 
\end{document}

enter image description here


Mathematics environments need to be wrapped by \begin{linenomath*} and \end{linenomath*} as mentioned in Bamzi's answer.

A quick way to change all your equations is to renew the equation environment by adding the code

\let\oldequation\equation
\let\oldendequation\endequation

\renewenvironment{equation}
  {\linenomathNonumbers\oldequation}
  {\oldendequation\endlinenomath}

before \begin{document}.