Normal equation for linear regression
It is basically a matter of convention, which becomes a bit more clear if you write the whole thing in terms of elements, rather than vectors. Consider

$$ \theta^T \theta = \sum_{n=1}^N \theta_n \theta_n = \sum_{n=1}^N \theta_n^2 $$

What is usually meant if you write $\frac{df}{d\theta}$ is that you take the gradient of a scalar $f$, i.e. you get a vector $\frac{df}{d\theta}$ where each element $i$ is the derivative with respect to the respective coordinate $\theta_i$:

$$ \left( \frac{df}{d\theta} \right)_i = \frac{df}{d\theta_i} $$

Let's apply this to $\theta^T\theta$:

$$ \left( \frac{d}{d\theta} \theta^T\theta \right)_i = \frac{d}{d\theta_i} \sum_{n=1}^N \theta_n^2 = 2 \sum_{n=1}^N \theta_n \frac{d\theta_n}{d\theta_i}  $$

and since $\frac{d\theta_n}{d\theta_i} = \delta_{i,n}$:

$$ \left( \frac{d}{d\theta} \theta^T\theta \right)_i = 2 \theta_i $$

If you interpret this as columns or rows is pretty much up to you. Commonly we would take $\theta_i$ as the elements of a column vector $\theta$ and for practicality we usually want the gradient to live in the same vector space as our coordinates, so $\left( \frac{df}{d\theta} \right)_i$ would also be a column vector. Hence

$$ \frac{d}{d\theta} \theta^T\theta = 2 \theta $$