Magnetized Kelvin–Helmholtz instability: theory and simulations in the Earth’s magnetosphere context