How do I use pagination in WordPress?

As in the comments, it’s not clear why you can’t use the options: dashboard -> settings -> reading -> Blog pages show at most [] posts

However, if it is necessary that this be done via altering the query (say to target only specific pages, or archives) then this should really be done on pre_get_post:

For instance to change the post’s per page for any archive for a term in the ‘my-tax’ taxonomy:

add_action('pre_get_posts','wpse26898_change_per_post');
function wpse26898_change_per_post( $query ){
    if( $query->is_main_query() && is_tax('my-tax') ){
        $query->set('posts_per_page'=>2);
    }
}