OK The divide by zero thing in windows is usually caused (or was caused) by a floating point error in the processor. Where the processor would **** up the math and try to execute an instruction in either a protected part of the processor or in an address that didn't exist. So for that scenario, not a whole lot you can do as the processor has stopped processing.
Now as to web servers throwing errors. One of the best ways to elevate rights on a web server is to look for XSS flaws
http://ha.ckers.org/xss.html is a good reference site.
As for applications like Java, .NET, VB, ASP If an unexpected variable is returned in the program, you would have to find what function created the unexpected variable and what memory address it was using. Then you would have to find an expected or allowed variable and insert it into that same memory space. Hopefully the next block is empty or can be over written.
Then it's just a matter of creating a buffer overflow and and exploiting what ever the flaw is that gives elevated rights.
So pretty much reverse engineering the app is needed, unless the programmer is a complete moron. Then all you have to do is view the page source before and after the error and how you get in will be written pretty much in English. Or more to the point HTML.
