Please tell me, is it possible to understand all this things if you are not a mathematican and even not a technical specialst?
finding the remainder is the elementary school level mathematics. and for the most part the modular arithmetic is also pretty simple and straight forward, in simple terms it says perform the arithmetic as before but when you are done you should compute the remainder of the result instead. for example to compute 5*6 (mod 7) you first compute 5*6=30 then compute the remainder 30%7=2. you don't need to be a mathematician to understand this.
the hard part (which is not included here) is the optimizations used such as mathematical theories to solve modular multiplicative inverse, or something as simple as MultMod.