$wp_query->current_post
is the build-in loop counter, starting with 0 zero for the first post in the loop.
so the line some code to be executed
could translate to:
<?php if( $wp_query->current_post > 0 && $wp_query->current_post % 5 == 0 ) { ?>
some code to be executed
<?php } ?>