Those paths of photons are not hard etched, meaning that it is a distribution of probable paths. The probability of photons reaching the detector will depend on phase differences between the paths. The photons that don't reach the detector due to destructive interference go somewhere else. Interference is the absence of energy exchange. If you somehow make all photons collect at the detector then the detector should record all photons.
In the diagram, phase difference is not equal for all paths because of beam splitter A and beam splitter B. Let me list the all possible (intended for typical MZI experiment) paths:
- SA(M1)BW
- SA(M1)BD
- SA(M2)BW
- SA(M2)BD
You see "D" comes in only two paths. Paths 2&4 goes to D while paths 1&3 wasted towards W.
Now let's assume each reflection off a beam splitter or a mirror adds in $\pi_{/2}$ phase to the photon. Above listed paths from here on will be abbreviated as P1, P2, P3 and P4.
We will consider two cases here as examples.
First case (when no phase change is introduced at X):
P1 will added $ \pi_{/2} $ per each reflection off A, M1 and B towards a total of $ _3\pi_{/2} $. P3 will only be adding $ \pi_{/2} $ off M2, and phase difference P1 and P2 will be $\pi$ meaning destructive interference towards W. So the probability of a photon reaching W is 0 in this case.
Now following the same procedure as I did for P1 we can see that P2 will add only $\pi$ while p4 also adds $\pi$, hence they are in the same phase meaning constructive interference.
This means all photons emitted by the source should reach D. (Probability of a photon reaching D is 1)
Second case (when $\pi$ phase change is introduced at X):
The situation changes drastically if you adjust X to introduce $\pi$ phase difference between paths A1 and A2. This will cause following results for the photon's probability of reaching the detector.
Now P1 will added same $ _3\pi_{/2} $ as before but P3 now will be
adding the same phase difference due to M2 and X. As a result they will be in the same phase and photons will be in constructive interference towards W.
In contrast, while P2 will be having same $\pi$ phase, p4 now will be adding additional $\pi$ due to X making phase of p4 to a total of $_2\pi$ phase change. This causes a phase difference of $\pi$ between paths P2 and P4, meaning destructive interference towards detector D. So the probability of reaching the photon to detector D is now 0 as all photons emitted from the source will be wasting towards W.
You can see how phase change introduced at X affect the probability of a photon reaching detector D. You cannot write equations omitting some possible paths, [in this case paths towards W]. If you include all possible paths then your equations should give the correct results.
Interference does not mean photon loss, but it can affect the probability of detecting photons at different locations. Interference is the phenomenon of superposition of two or more waves, resulting in constructive or destructive interference depending on their relative phase and polarization. When photons interfere, they do not annihilate each other, but they can change their direction or energy due to their interaction with other photons or matter.
For example, in the classic double-slit experiment, photons that pass through two slits interfere with each other and form an interference pattern on a screen. The interference pattern shows regions of high and low intensity, corresponding to constructive and destructive interference, respectively. However, the total number of photons detected on the screen is equal to the number of photons emitted by the source.
Another example is the Hong-Ou-Mandel (HOM) effect, where two indistinguishable photons impinge on a balanced beamsplitter. The interference of the photons causes them to bunch together and exit through the same output port of the beamsplitter, resulting in zero coincidences between the detectors placed at the two output ports. However, this does not mean that the photons are lost; they are simply redirected to only one of the detectors at a time.
If you want more details about your equations I suggest you read this: Using a Mach-Zehnder Interferometer to Illustrate Feynman's Sum Over Histories Approach to Quantum Mechanics