solutions to this functional equation $f(x) = f(x^k)$ $f(x) = f(g(x))$ where $g(x) = x^k$.
This turned out to be much harder than it appeared initially. There are a couple of things I have figured out which will get you at least one solution: first is that this is not different from solving the more generalised $f(x) = f(g^n(x))$ for any $n$, secondly, it is easier to solve similar equations:
$h(g(x)) = h(x) + c$,
$h(x^k) = c-h(x)$ and 
$h(x^k) = -h(x)$ 
Once we have a solution to $h(x)$, we could then convert it to $f(x)$ by taking the sine or cosine.

Example:
In order to solve $h(x) = h(x^{k^n})+c$, $f$ must transform $n$ from a
  double exponent into a linear addition, therefore it must take the
  logarithm twice. This would yield $c = -\log_P{k}$ and
  $h(x)=\log_P{log_Q{x}}$ for any $P,Q$ when $n=1$. Therefore $$f(x) = 
 Asin(\frac{2\pi}{\log_Pk}(\log_P\log_Q(x^k))$$ for chosen constants
  $P,Q,A$ in their appropriate ranges. There are other trivial variants
  such as the square of the same function or cosine of the input. This function
  is periodic in some sense.

My question is just, how do we solve the second and third equations for
$h(x)$? I can see that it is equivalent to $h(x^{k^{n}})=h(x^k)$  for
even $n$ and $h(x^{k^{n}})=c-h(x^k)$ for odd $n$. I can't see much
further with the third equation.
Another thing that may be of interest is whether there is any general behaviour for the solutions to this type of functional equation for any $g(x)$. At first I thought there should be some sort of periodicity since $f(x) = f(g^n(x))$ must be periodic for $n$ but later dismissed that. The reason being that, even for simple functions like $g(x) = \frac{1}{x}$, a nice solution by sight is $f(x) = (\log(x))^2$ which really doesn't show any periodicity at all.
 A: $$h(x^k)=c-h(x)$$
Let us define the function $\psi$ as
$$\psi(\ln x)=h(x)$$
so that we have, from our our original functional equation,
$$\psi(k\ln x)=c-\psi(\ln x)$$
and let us make the substitution $y=\ln x$. Then
$$\psi(ky)=c-\psi(y)$$
again, let $\phi(\ln y)=\psi(y)$. Then
$$\phi(\ln k+\ln y)=c-\phi(\ln y)$$
and then if we make the substitution $z=\ln y$,
$$\phi(z+\ln k)=c-\phi(z)$$
By guess-and-check, a solution to this is
$$\phi(z)=\sin\bigg(\frac{\pi z}{\ln k}\bigg)+\frac{1}{2}c$$
And after we undo all of our substitutions, we get
$$h(x)=\sin\bigg(\frac{\pi \ln(\ln x)}{\ln k}\bigg)+\frac{1}{2}c$$
Does this work for you?
As for your general equation, that can be solved by
$$f(x)=\sin\bigg(\frac{2\pi \ln(\ln x)}{\ln k}\bigg)$$
GENERAL TIP: If you want to solve any functional equation for $f$ (given $g$) in the form
$$f(x)=f(g(x))$$
Then to find a sinusoidal solution, all you need to do is find a function $\gamma$ with the property
$$h(g(x))=x+2\pi$$
and then you can let
$$f(x)=\sin h(x)$$
for a quick and easy answer.
A: General solution to $f(x)=f(x^k)$ (with $k\ge 2$) for all $x\in \Bbb R$:
We can define $f(0)$ and $f(1)$ arbitrarily. After that, we can solve on domains $(1,\infty)$ and $(0,1)$ independently. If $k$ is odd, we can also solve on $(-1,0)$ and $(-\infty,0)$ independently and pick an arbitrary value for $f(-1)$; on the other hand, if $k$ is even, we must make $f(-x)=f(x)$.
We concentrate on the domain $(1,\infty)$ (because $f$ is a solution on $(0,1)$ if and only if $x\mapsto \frac 1{f(1/x)}$ is a solution on $(1,\infty)$; similar transforms apply for $(-\infty,1)$ and $(-1,0)$ with odd $k$).
We note that $\ln\circ \ln$ bijects $(1,\infty)$ to $\Bbb R$ and that $f$ fulfils $f(x^k)=f(x)$ on $(1,\infty)$ if and only if $g(x):=f(e^{e^ x})$ fulfils $g(x+\ln k)=g(x)$, i.e., is periodic with period $\ln k$. 
Thus we can pick any function $\gamma\colon [0,\ln k)\to \Bbb R$ and let
$ g(x)=\gamma(x-\lfloor \frac x{\ln k}\rfloor \ln k)$ and then $f(x)=g(\ln\ln x)$ for $x>1$.
Thus the general solution is described as follows:

Let $\gamma_i$, $1\le i\le 4$, be arbitrary functions $[0,\ln k)\to \Bbb R$, except that $\gamma_3=\gamma_2$ and $\gamma_4=\gamma_1$ if $k$ is even.
  Let $c_{-1}, c_0, c_1\in \Bbb R$ be arbitrary, except that $c_{-1}=c_1$ if $k$ is even. Define $g_i\colon(1,\infty)\to\Bbb R$ by $g_i(x)=\gamma_i(x-\lfloor \frac x{\ln k}\rfloor \ln k)$.
  Then
  $$f(x)=\begin{cases} g_1(x)&\text{if }x>1\\
c_1&\text{if }x=1\\
g_2(1/x)&\text{if }0<x<1\\
c_0&\text{if }x=0\\
g_3(-1/x)&\text{if }-1<x<0\\
c_{-1}&\text{if }x=-1\\
g_4(-x)&\text{if }x<-1\\
\end{cases}$$
  is a solution to $f(x^k)=f(x)$, and every solution to $f(x^k9=f(x)$ can be obtained this way.

We get a few more restrictions if $f$ is required to be continuous:

The above solution is continuous if and only if $c_1=c_0=c_{-1}$, and $\gamma_2(x)=\gamma_3(x)=c_0$ for all $x>1$, and $\gamma_1,\gamma_4$ are continuous with $\lim_{x\to \ln k}\gamma_1(x)=\gamma_1(0)=\lim_{x\to \ln k}\gamma_4(x)=\gamma_4(0)=c_0$.

Similar conditions can be readily written down to make $f$ smooth.
