It's pretty simple (IMO, of course), if you want the better image quality, high ISO, higher quality screen, buy a 500D.
If you want slightly better quality plastic, and some magnesium in the chassis, buy a 40D. (oh yes, and the camera snobs will tell you the "handling" makes up for the loss of image quality, lack of high ISO etc

).
IQ is really down to the lens and the photographer .. i'm yet to see anything that substantiates that a 500D gives better image quality than a 40D - more mega pixels yes, but that doesnt automatically equate to the same thing.
and the screen is pretty much the same on both. (that is on both models its a 3" TFT - on the 500D its higher resolution (920k dots vs 230k) but still not high enough to judge sharpness which is all that really matters - I usually have my LCD turned off anyway to save power, unless i am checking the exposure via histogram)
High ISo is a valid point
However - you also neglect the points that FPS is lower on the xxxD series than it is on the xxd , that the metering is better on the xxD, as is the AF , and that the 'handling' is nothing to do with being a camera snob - its to do with people with big hands finding the xxxD too small unless a battery grip is added.
At the end of the day you pays your money and takes your choice.. if you want a small light camera with decent iso performamce and arent concerned about the other issues then buy a 500D (you could also look at a 550D which arent much more)
If you want a larger camera with faster FPS, better metering and AF and you arent concerned about high iso then buy a 40D
and if you want all of the above save your pennies for a bit longer and buy a 50D (or 60D, or 7D depending on how much you want to spend)
I don't know much about the nikon so i can't advise how these compare
However any of these cameras are capable of getting good shots, and either nikon or canon is a system you can grow with (they are also several others including sony, olympus, and pentax ) but at the end of the day you are just going to have to make a choice, chances are good that you won't regret buying any modern mid level DSLR