  The standard paradigm of cosmology assumes General Relativity (GR) is a valid
theory for gravity at scales in which it has not been properly tested.
Developing novel tests of GR and its alternatives is crucial if we want to give
strength to the model or find departures from GR in the data. Since
alternatives to GR are usually defined through nonlinear equations, designing
new tests for these theories implies a jump in complexity and thus, a need for
refining the simulation techniques. We summarize existing techniques for
dealing with modified gravity (MG) in the context of cosmological simulations.
$N$-body codes for MG are usually based on standard gravity codes. We describe
the required extensions, classifying the models not according to their original
motivation, but by the numerical challenges that must be faced by numericists.
MG models usually give rise to elliptic equations, for which multigrid
techniques are well suited. Thus, we devote a large fraction of this review to
describing this particular technique. Contrary to other reviews on multigrid
methods, we focus on the specific techniques that are required to solve MG
equations and describe useful tricks. Finally, we describe extensions for going
beyond the static approximation and dealing with baryons.
