"So, my new questions are:
1) how can I tell if it's the derailleur that's bent or if it's the hanger that's bent?
2) how do I go about fixing either of the above?"
is your hanger part of the FRAME, or part of the DERAILLEUR?
sounds like it's TWISTED... FLIP the bike onto it's seat and bars... then, look at the jockey/idler cage from above, with the gears in the smallest sprockets, front and rear... apply an adjustable wrench to the hanger if it's part of the derailleur, and twist it back into position, plus a bit, since metal has a MEMORY, and will want to return to it's former state some... IF the hanger is part of the FRAME, remove the derailleur(this prevents damaging the der.), and twist the hanger in the manner described above... Remount the Der., and take another look at the alignment of the der. cage from above... is it now aligned? if so... go ride it after resetting the limit screws, checking/setting the cable(if needed), and testing the shifting... if not aligned, repeat as needed.
Tip: if your bike has INDEXED shifting, turn the high gear limit screw in a turn or so before setting the cable tension, then turn the screw back to it's original position after setting the cable...... this pre-loads the cable a bit, and takes up any slop from sharp bends in the cable routing. ;-) i do this "pre-loading" freehand... works just fine, and saves having to use up adjustment at any adjusting ferrules in the cable run... been doing the pre-loading for 50 years now... i've owned hundreds of bicycles, and have never taken any of them to a shop for repair. Now, i am the "shop" in my town.