Hi,
for count the product on compare you have to do something like that
$products_list = isset( $_COOKIE[ $this->cookie_name ] ) ? json_decode( $_COOKIE[ $this->cookie_name ] ) : array();
$count_products = count( $products_list );
so, $count_products is the number of products currently on compare table.
About the second question you can retrive the compare view link with this code
global $yith_woocompare;
if( ! is_admin() ){
$view_compare = $yith_woocompare->obj->view_table_url();
}
$view_compare is the link to open the compare table.
Hope this is helpful for you. Regards ??