I actually was able to fix the relay instead of replacing it! It was easy. I removed the relay's cover (by bending back a few metal tabs). Inside are two metal strips whose ends almost touch. One of them is wrapped in wire that is connected to two of the terminals, and the other one is connected to the third terminal. The "free" strip is almost, but not quite, touching the "wrapped" strip. First I checked the resistance of the wire, which was about 40 ohms: that confirmed the wire wasn't shorted or broken. The strips seemed kind of far apart (I assume they need to touch when the one strip bends toward the other one), so I bent the free one until they were almost touching. Then I put it back together and reinstalled it. Now it works!
I'm still not sure exactly how this thing works. I notice that it takes a second (after one of the car doors is opened) for the ignition light and dome light to come on, and about 10 seconds (after both doors are shut) for the lights to go out again. Also, the relay only draws current while the light is on. Somehow when it cuts power to the lights it cuts power to itself too. The relay only gets reenergized when one of the doors is opened again.