I have had this strange feeling recently that somehow, the theory of martingales we study in probability, and the theory of Fourier analysis are very alike. But I am not able to formalize my thoughts.

To illustrate, let us focus on $f\in L_1(\mathbb T,\mathcal B_{\mathbb T},Leb)$. Define $S_N(f)(x)=\sum_{k=-N}^N \hat{f}(k)e^{ikx}$, the $N$-th partial sum of the Fourier series of $f$. It seems to me that $\{S_N(f)\}_N$ is essentially like a random walk, as the increment $\hat{f}(N)e^{iNx}+\hat{f}(-N)e^{-iNx}$ at the $N$-th stage has mean $0$, and it is orthogonal to $\{1,e^{\pm x},...,e^{\pm (N-1)x}\}$, which would perhaps translate to independence and thus it seems plausible that $\{S_N(f)\}_N$ is a martingale. Of course, independence, conditional expectations, etc. are probably not meaningful terms in classical analysis, and this is one thing I am unable to formalize.

Now let me come to the convergence results. It is well known that in martingale theory, for $p>1$, an $L_p$-bounded martingale converges a.s. and in $L_p$. In Fourier analysis, we have the result that $L_p$ norm convergence of $S_N(f)$ to $f$ (if $f\in L_p$) is equivalent to $\sup_N ||S_N||<\infty$ where $S_N:L_p\to L_p$ is being treated as a linear operator. So here we have the analogy with $L_p$ bounded martingales. Further, for $p>1$, we have $S_N(f)\to f$ a.e., again in analogy.

The results for both Fourier series and martingales fail when $p=1$ and you need more conditions like uniform integrability of martingales, which, I think, translates to $\sum_n |\hat{f}(n)|<\infty$. I also do not know what happens to this little jump from 1 to $p$ that makes both these two results work/fail. I can feel these two theories go parallelly but it seems quite mysterious to me.

Maybe there is a connection which I cannot see?