The endnotes package interferes with headers text, but only if the document has an odd number of pages. Here is a minimal working example:

\documentclass{amsart}

\usepackage{endnotes}

\begin{document}

\title{My Title}

\author{My Name}

\maketitle

\thispagestyle{empty}

First page

\endnotetext{first note}

\newpage

Second page

\endnotetext{second note}

\newpage

Third page

\endnotetext{third note}

\theendnotes

\end{document}


On the last page where the end notes are printed, the header becomes "Notes" instead of "My Title". If however I remove the third page (or add a 4th one) then the header shows the author name (as it should be).

I believe that this is related to Endnotes and headers

I tried the two fixes there: \addtoendnotes{\protect\markboth{Note}{Note}} makes no difference and \def\notesname={\relax} crashes latex (unless I put it near the top of the file, in which case it makes no difference).

\theendnotes adds a mark when it executes the \enoteheading command which does the job of printing the header with \notesname. Without any other hook, the simple thing to do would be to redefine \enoteheading as follows:
\renewcommand{\enoteheading}{\section*{\notesname}%

Incidentally, your command \def\notesname={\relax} is actually defining \notesname with a template requiring = to follow it. The = doesn't belong there. In general, it's better to stick with the LaTeX commands for defining/redefining commands than to drop down to the plain TeX \def.
• For amsart I'd recommend also removing \mbox{}\par\vskip-\baselineskip, which is useless as the class does indent the first paragraph after a title. Actually the package should do \@afterindenttrue instead of that concoction. Dec 21 '20 at 22:44