Welcome @alyan231213 ! thanks for joining our community, there are two modes of simulation, offline and online. For offline mode behind the scenes we use algorithms to calculate current, voltage and ohm via matrixes, check this useful link to see what it takes to calculate results https://aice.sjtu.edu.cn/msda/data/courseware/SPICE/lect07_element_stamping.pdf
For the online mode, we build a netlist when using NGSpice option by which the circuit can be processed at cloud using NGpsice library.
For information about NGspice library, check out https://ngspice.sourceforge.io/