How to place an image after Nth number of posts in query_posts

Multiple nested if statements can create a mess you might look into using a switch for this case.

Something like:

  //your $args
  $the_switch_query = new WP_Query($args);

  while ( $the_switch_query ->have_posts() ) : $the_switch_query ->the_post(); 

  $query_number = $the_switch_query->current_post + 1; //count them

       switch ($query_number){

             case 1;
             echo "post one";
             break;

             case 5;
             echo "post five";
             break;

            // more cases

            default:
            echo "default";
        }
       //rest of your stuff