If you add an HTML comment to a visualforce page, this will be removed when the page is rendered. In cases where the comments are actually controlling how the page behaves (e.g. CSS conditional comments or knockout.js containerless foreach) the comment has to be built up from a number of elements including the dreaded apex:outputText with the escape attribute set to false. E.g. rather than writing:
<!-- ko foreach: daysOfWeek -->
I have to write:
<apex:outputText value="<" escape="false"/>!-- ko foreach: daysOfWeek --<apex:outputText value=">" escape="false"/>
It would be nice to either have comments retained or to have an apex component that generates a comment.