How to list users and their post amount?

WordPress has a wp_list_authors function with the option to list post count.

<?php
$args = array( 'orderby' => 'post_count', 'optioncount' => true);
wp_list_authors( $args );
?> 

EDIT: While it’s possible to do it the way you’re doing it and use count_user_posts(), this will trigger a query to retrieve users, then additional queries to get each user’s count. this is a very inefficient way to do this and may have a significant impact on performance if you have a lot of authors. A better way is to select users, and count the posts all in one query. If you look in wp-includes/author-template.php you’ll see the query wp_list_authors generates to do this.