How do amplify and equzlization mix together.

I have found that at times when you use equalization, it amplifies the audio some.

And sometimes it hardly has any amplification.

How does the value from from amplify dialog and the gain from the equalization relate?

And how do you decide, how much negative amplification to compensate for any equalization amplification.

The “Amplify” effect will always open with settings to provide the maximum possible amplification without “clipping”.
“Clipping” is distortion that is caused if any peaks in the waveform try to go above 0 dB.
0 dB is from the top to the bottom of the audio track. Digital audio cannot go higher than this without distorting.

The default “32 bit float” format that Audacity uses can go over 0 dB, but when played it will be clipped by the sound card. This means that, as long as the audio tracks are in the default 32 bit float format, it is OK to temporarily exceed 0 dB, but the level will need to be reduced before you play or export. The sample format is shown in the box on the left end of the audio track.

They do not directly relate.
If you boost the 1000 Hz band on the Equalization effect by +12 dB and apply that to a “Sine Tone” that has a frequency of 1000 Hz, then the tone will end up 12 dB bigger.
(see the “Generate menu” for generating tones
If you apply the same boost at the same frequency to a Sine Tone that has a frequency of 5000 Hz, then the Equalization boost will have no effect.
Boosting or cutting frequencies with the Equalization effect will only affect those frequencies in the selected audio.

If you want the overall level to be 0 dB, AND you are using the default 32 bit float format, then you can simply use the default settings in the Amplify effect immediately after applying the Equalization effect.

Note also that the current version of Audacity also has a simple “Bass and Treble” effect that can automatically adjust the overall level after applying the boost/cut to the bass / treble: