\documentclass{article}

\begin{document}

% Comments should be indented along with other text
(these parentheses
  make the middle line here
  % and this comment aligns with the text
indented as usual)

% Comments do not directly affect indenting,
% so they can contain arbitrary brackets ((((
% which may not match.

% Similarly they might contain \begin{align}
unmatched % environment tags.

This is a percent sign \% and not a comment

Some lines might have both \% percents % and comments \end{align}

\end{document}
