Insert HTML content in WP Query at specific point

The global $wp_query is the default query you’re working on when you use have_posts(), the_post() etc, so just add

global $wp_query;
if($wp_query->current_post == 4) echo "4!";

global might or might not be necessary (and is certainly only necessary once, so just add it before the while loop), it depends whether you’re in the original template or in a template that has been included via a function call.