The $12$ students can be lined up in $12!$ ways.
Put in dividers after every fourth student.
For example:
Given $ABCDEFGHIJKL$, we would put in dividers to get $ABCD|EFGH|IJKL$.
We have overcounted, though, in two different ways. Let's examine the resulting problems.
One problem is with regard to the three separate groupings appearing multiple times. In the example above, we would be counting $EFGH|ABCD|IJKL$ a second time. Since there are three groups, we need to divide by $3!$ to avoid this sort of overcounting.
The second problem is that, within each of the three groups, we have four people who are going to appear multiple times. In the example above, we would be counting $CDAB|EFGH|IJKL$ a second time. For each of the groupings, we need to divide by $4!$ to avoid this sort of overcounting. This means dividing by $4!4!4!$ to amelioriate the second issue.
Then our answer becomes:
$$\frac{12!}{3!4!4!4!} = 5,775$$
Because the groups of $2$ and $1$ are distinct sizes, you don't have to consider reordering those groups. The denominator should be $2!=2$ because there are $2$ ways to order the two groups of three. The numerator is correct.
Best Answer
There are many approaches to an answer. Note that the job cannot be done if $n$ is odd. So let $n$ be even, say $n=2m$.
For concreteness, let $n=10$.
Line up the students in increasing order of student number. The first person in the list can choose her study partner in $9$ ways. For every such choice, the so far unpartnered student with smallest student number can choose her study partner in $7$ ways.
For every such choice, the so far unpartnered student with smallest student number can choose her study partner in $5$ ways. For every such choice, the so far unpartnered student with smallest student number can choose her study partner in $3$ ways. That gives a total of $(9)(7)(5)(3)$ ways.
The answer looks a little nicer if we write instead $(9)(7)(5)(3)(1)$. Maybe to make things look even nicer, we can multiply top, and missing bottom, by $(10)(8)(6)(4)(2)$. We get $$\frac{10!}{(10)(8)(6)(4)(2)},\quad\text{which is} \frac{10!}{2^5 \cdot 5!}.$$
Now that we have gone through the reasoning got $n=10$, the general case is straightforward. Suppose there are $2m$ students.
The student with lowest student number can choose her partner in $2m-1$ ways. For every such way, the so far unpartnered student with lowest student number can choose her partner in $2m-3$ ways. And then the so far unpartnered student with lowest student number can choose her partner in $2m-5$ ways, and so on, for a total of $$(2m-1)(2m-3)(2m-5)\cdots(3)(1).$$ The same manipulation as before gives the more compact expression $$\frac{(2m)!}{2^m \cdot m!}.$$