Energy and Procs:
Each hero attack (both offense and defense) gains 15 energy. Energy is not gained from a proc on the attack; however, an enemy receiving the procs blow will gain 15 energy (independent of normal attacks) I.e. thunder god from across the map. The energy bar has a maximum value of 100 and it must be reached before the proc can occur. Therefore it takes 6 attacks to reach 90 energy, 7th attack to reach 100 energy (the remaining 5 gets lost), and an 8th attack activates the proc. On the next series you will start with 15 energy so it will only take 6 more attacks to reach 100 energy, and you will proc on the 7th attack.
This is not technically true, though. A proc is not able to activate until the energy bar is full. When the energy reaches 100 the proc activates upon the next attack - meaning a proc cannot occur just after filling to 100 nor can it occur randomly while sitting at 100 (walking, defending, etc.).
I say it activates upon the next auto attack, but it actually happens the instance before the auto attack. This means if your hero is attacking a building or enemy and the proc destroys the target, your hero was never able to auto attack, thus no energy was gained. You may notice this on HBM.
When fighting the boss or arena you'll notice your hero takes 7 attacks to fill energy and it procs on the 8th, but then your hero only takes 6 more attacks to reach full energy before procing on the 7th attack. The issue here is that a proc resets your energy to 0 just an instant before your 8th attack. The 8th attack is actually the 1st attack of a new series, thus your hero gains 15 energy. Now we will count up to 7 and every 8th = 1st. In practice it appears like this: 1, 2, 3, 4, 5, 6, 7, (proc)8, 2, 3... 7, (proc)8, 2... So you see it always takes the same amount of attacks to reach full energy and proc. The only exception is when the target is eliminated from the proc resulting in no 8th attack. Then you'll have to start counting from 1 again instead of 2.
From my experience/knowledge there is no situation where energy is carried over from a proc. I've never seen a hero end with 5/10 energy after a proc unless that hero is being attacked by troops or towers. Also keep in mind all these calculations assume there is no scatter, cupid, mino, or other influences.
Energy and Procs:
Adds 15 unless they reach the cap of 100 which then it would gain the difference. Basically if they receive an attack then just count as if your hero attacked an extra time. So for example in boss fight when your heroes get hit with the aoe proc, you will count like 2, 3, 4(5), 6, 7, (proc)8, 2, 3...
Nothing difficult to understand about receiving attacks. Hope that makes sense.