You can place this inside your post loop just before the loop ends. It will output your desired div (ad) after the 2nd post. Just make sure you add in any necessary CSS classes to the div, and of course your ad code or image.
<?php if ( $wp_query->current_post == 1 ) { ?>
<div>Put Ad Here</div>
<?php } ?>
So it should look something like this within your post loop:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content' ); ?>
<?php if ( $wp_query->current_post == 1 ) { ?>
<div>Put Ad Here</div>
<?php } ?>
<?php endwhile; endif; ?>
This works by using the $current_post
property of the WP_Query class. It retrieves the index of your current post in the loop.
Hope this helps!