That looks like a formula that has been found by any number of school kids. You can divide an a-gon into a isosceles triangles having base length x and vertex angle 360/a. Each of those triangles can be divided into two right triangles with "opposite side" x/2 and angle 180/a. The altitude of each isosceles triangle is the "near side" of the right triangle which has length (x/2)cot(180/a) so the area of each isoscelese triangle has area (1/2)(x)((x/2)cot(180/a)= (1/4)(x^2)cot(180/a). Although I personally would leave it that way, since cot(x)= tan(90- x), you can write that as cot(180/a)= tan(90- 180/a)= tan((90a- 180)/a)= tan((180a- 360)/2a).
Congratulations on finding that on your own!