In the Table Rate table shipping module the variable $total_count tells you how many items are in the cart ...
$total_count - $_SESSION['cart']->free_shipping_items() tells you how many are in the cart that are not marked as Free Shipping ...
The Handling fee comes from the value of MODULE_SHIPPING_TABLE_HANDLING and you can see where that is used in the module and adjust its value ...



