There's a great read on the subject
here. It's written around the 737, but the principles apply to other ships.
Actually, since I'm a graphical kind of guy, I like a graphical presentation but I have not yet found one online. It should include a chart of typical airfield-limited performance weights vs OAT, and a chart of N1 (or EPR) vs OAT. Using these it's fairly easy to understand how ATM or flex is computed.
And don't forget, even though you're running the engine at a thrust level equivalent to a 40C day, the wing is flying in (e.g.) 20C air. Thus your V1, Vr etc. TAS is quite a bit lower. All this means extra margin.