Trying to display ads on only a third of posts in a loop. Keep getting Error 500?

echo "<img src=\"" . bloginfo('template_url'); . "/img/sample-ad-side.png\" alt=\"Sample Advertisement\">";

You added a semicolon, what comes after that semicolon is a new statement. . "img/ etc is not valid PHP, so it errors out.

Also bloginfo does not return its value, it prints it, so you need to change that to get_bloginfo.

I would suggest you look up basic PHP error handling so that you can look at the error logs. I also recommend you get a proper code editor that will highlight syntax errors in bright red. Sublimetext/Komodo/PHPStorm/Netbeans/etc will all do this. Syntax errors are a solved problem, you shouldn’t have to look for them, they should be pointed out to you by your code editor