How to check if a user is in a specific role?

If you only need this for current user current_user_can() accepts both roles and capabilities.

UPDATE: Passing a role name to current_user_can() is no longer guaranteed to work correctly (see #22624). Instead, you may wish to check user role:

$user = wp_get_current_user();
if ( in_array( 'author', (array) $user->roles ) ) {
    //The user has the "author" role
}