The physics
A capacitor stores charge +Q and −Q on its two plates. The charge grows with the voltage: Q = CV.
Capacitors side by side share both ends. Each gets the same voltage, and their capacitances add.
side by side: C = C₁ + C₂ + …
Capacitors in a line carry the same charge. Their voltages add to the battery's.
in a line: 1/C = 1/C₁ + 1/C₂ + …
A balanced bridge (C₁/C₂ = C₃/C₄) leaves the middle capacitor empty. Otherwise, balance the charge at each point.
Joined capacitors share one voltage. The total charge stays, but some energy turns into heat.
heat = C₁C₂(V₁ − V₂)² / 2(C₁ + C₂)
A point with no path to the battery keeps its net charge. Throwing a switch does not change it.