Look in the server log, which on Linux is normally in something like /var/log/apache2 or /var/log/httpd.
Download Firebug, intercept the ajax call and load it in the browser or look at its output. Make sure you server is set to report errors (look at php.ini for PHP settings, for example). Whatever is causing it is probably going to show up.
Make sure you don't actually throw the error 500 yourself in the code.
If you use PHP, then use a debugger, such as PHPEd or xdebug and step through the code. That's the way I debug my PHP and it's the best way, though takes some time to set up.