The code you showed basically translates as:
if the total number of posts is odd
loop through all posts
format them all as odd
end
else
loop through all posts
format them all as even
end
end
The code esmi provided sets the post class based on the count of each post. So, post 1 would get a class of 'displayed_post1' and post 2 would get 'displayed_post2 alt'. All of the even posts would get a class of 'alt'.
If I might alter the code a bit:
<?php $postnum = 0;?>
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $postnum++;
$alt = 'displayed_post' . $postnum;
$alt .= ( $postnum % 2 ) ? ' even_post' : ' odd_post';
?>
<div <?php post_class($alt);?>>
Now, you can use CSS of .even_post and .odd_post to set the formats.