The second partial derivative test is based on a formula which seems to come out of nowhere. Here, you can see a little more intuition for why it looks the way it does.
License: CC BY-NC-SA by Khan Academy