Wordpress - How does WordPress handle permalinks?
The redirect_canonical function in /wp-includes/canonical.php is called on any given URL and will attempt to best-guess the URL the user wanted, and redirect them to there, when a URL does not exist. It has a whole huge amount of code to do this for all sorts of common errors.
Use @JanFabry "Rewrite Analyzer" Plugin, over here in the "official" WPSE Plugin repository