I was reading about transmon qubits, and I know that they are not true two-level systems. Are there any math/papers which talk about how those extra energy levels affect the computation? I'm assuming it may have a small effect.
When non-computational states are unintentionally populated, this is called leakage, and it is one of the leading sources of error in transmon qubits. Originally, the transmon emerged from an earlier design called the Cooper-pair box, which suffered from charge noise. By adding a large shunt capacitor, the sensitivity of the device to charge noise was greatly reduced, at the expense of lowering the anharmonicity. The anharmonicity is the difference between the 1-2 energy level spacing to the 0-1 energy level spacing. A perfect two-level system has infinite anharmonicity (the next accessible level is infinitely far away from the computational space, so there is no chance of leakage), and the worst possible "two"-level system has 0 anharmonicity (one example is a harmonic oscillator). Transmon qubit frequencies are usually a couple GHz, while their anharmonicities are a couple hundred MHz (and negative, which means $|2\rangle$ is closer to $|1\rangle$ than $|0\rangle$).
Leakage errors might arise from making single-qubit drive pulses too fast, leading to wide spectral signatures that overlap with the 1-2 energy spacing (one way to combat this is with DRAG pulses, or with direct optimization of the pulse waveform). They could also occur from diabatic errors during ideally adiabatic 2-qubit gates (see Section IV.F.I of this paper for a summary, and this paper for a solution using Slepian pulses). Leakage errors also are problematic in quantum error-correction, because they are not correctable within the standard framework of the theory. Thus, there has also been work on characterizing and mitigating their effects within that context.