What factors go into choosing DCT type 1 over type 2 or type 3 etc?
As you described correctly, DCT is closely related to DFT. The two main motivations behind DCT are it's being a real transform and its compaction of signal energy. The first makes it computationally simpler, while the second makes it a prime tool for transform based lossy data compression applications. As you understood correctly.

Then what remains is where the types come from and why is it the DCT-II as the most common choice for data compression? The answer is as follows:

Given a signal $x[n]$ of length $N$, The different DCTs are defined by forming even-symmetric extensions of shifted copies $x[n]$ in a number of possible ways, each different combination yielding a different type of DCT. Also the odd-symmetric extensions are called as the DST (Discrete Sine Transform).

The DCT-II , by virtue of its type of symmetry, has the most energy compaction among other DCT types and therefore is naturally the choice.

The DCT-II signal formation (based on A.Opp DTSP-2e) is as follows:

Consider a signal $x[n]$ of length N, whose DCT-II we want to compute. First extend $x[n]$ by padding $N$ zeros and create the extended signal $x_e[n]$

Then the DCT Type-II signal $\tilde{x}_2[n]$ is a periodic signal with period $2N$ and related to $x_e[n]$ as:
$$\tilde{x}_2[n] = x_e[((n))_{2N}] + x_e[((-n-1))_{2N}]$$
whose base period $x_2[n]$ extends from $n=0$ to $n=2N-1$. And where the $((\cdot))_{N}$ operation here is the modulus operator, providing the periodicity of $\tilde{x}_2[n]$. 

Eventually, it is shown that the $N$-Point  unnormalised  DCT-II, $X_{c2}[k]$, of the signal $x[n]$ is related to the $2N$-Point DFT, $X_2[k]$, of the signal $x_2[n]$ as: 
$$X_{c2}[k] = e^{-j\pi k/{2N}} X_2[k]$$
for $k=0$ to $k=N-1$

The following Matlab script creates the Type-II DCT signal $x_2[n]$ from $x[n]$ and finds DCT of x[n] from DFT of x2[n] for comparison 

N=8;                            % Period for x[n]
n = [0:2*N-1];                  % A set of sequence indices of at least length 2N
x = [1:N];                      % A ramping test sequence for x[n] of period N
xe = [x zeros(1,N)];            % Extended sequence from x[n], by padding N zeros
x2 = xe(1 + mod(n,2*N)) + xe(1 + mod(-n-1,2*N));    % DCT-II type periodic signal
DFTx2 = fft(x2,2*N);            % 2N-Point DFT of x2[n]
Dft2Dct = real( exp(-j*pi*[0:N-1]./(2*N)).*DFTx2(1:N) );   % Create N-DCT of x[n] from 2N-DFT of x2[n]
DCTx = sqrt(2*N).*dct(x,N);     % N-POint DCT of x[n], for test purposes
DCTx(1)= sqrt(2)*DCTx(1);       % UNnormalise the Matlab's default normalised DCT-II