What is an instrumentation amplifier and how does the AD524 work?
An instrumentation amplifier is a difference amplifier (your orange box) with buffered inputs (your blue and green boxes) to achieve higher input impedance than a simple op amp difference amplifier1. There are two basic architectures: the three op amp one you show, and a two op amp version (see, e.g. here). You can build one out of discrete op amps or use a in amp IC (the latter is usually better). In amp ICs often have a variety of features to make them easier to use, more accurate, etc., and the AD524 has a number of those features.
The AD524 is based on the three op amp architecture, but its inputs use two op amps each to achieve a double inversion. Its datasheet explains why the &quot;preamplifier&quot; is designed this way under the &quot;Theory of Operation&quot; section on page 15.
The datasheet also explains how the gain is determined in the &quot;Gain&quot; section starting on page 16. You can either connect an external resistor to to pins RG1 and RG2 to set \$R_{\text{gain}}\$ (the datasheet provides the formula), or you can short RG2 to pin 11, 12, or 13 to set the gain to 1000, 100, or 10, respectively (or leave RG2 open for a gain of 1). The latter method offers only limited gain choices but eliminates the need for an external resistor and is more accurate because it uses only the internal, trimmed resistors.
Another unusual aspect of the AD524 is the SENSE pin, which is normally shorted to the OUTPUT pin (most in amps do this internally) but can be connected directly to the load for better accuracy. This is explained in the &quot;Sense Terminal&quot; section on page 18.
In short, it's best to read the datasheet to understand how the in amp works.

1 This is a simple op amp difference amplifier, which does not have buffered inputs:

The input impedances of this circuit are determined by the resistors and is therefore lower than the input impedance directly at the input of an op amp input (the latter is what you get with an in amp).