How can I detect if node is the last one from within node.tpl.php? There are a number of variables for the node.tpl.php template, like $id that contains the current nodes index number, but how can I figure out if the current node is the last index or how many nodes there are in the current listing?

(I'm using Drupal 7)
In general, it is not a good idea for Drupal objects to not "know" how they are being used on a page.  When you make them "self-aware" you introduce artificial dependencies that can make changes down the road harder to make, or inadvertently introduce bugs.

In you case, I would handle this in the views templates.  Out of the box, the last row should have a views-row-last class on it.

Otherwise, you need to implement a template_preprocess_node in your theme.  The view object will be available as $variables['view'].  You would need to add logic to check page, view name, etc, to make sure you are doing things in the right place.  Off the top of my head, I forget which properties you need to check; do a kpr($variables['view']) and poke around.