A permutation $\sigma \in S_n$ has a unique representation as the product of disjoint cycles. We show that $\sigma$ has a square root in $S_n$ if and only if the number of cycles of same even length in the representation is even (or zero). This condition is necessary because the square of an cycle of even length $2k$ splits in to two disjoint cycles of length $k$ and squares of cycles of odd length have odd length.
Your example permutation is an odd cycle, and hence has no cycles of even length. Thus it satisfies the condition. Another example would be $(12)(34)(567)$ which has two cycles of length $2$ and no even length cycles of other lengths.
For an algorithm to find the root when $\sigma \in S_n$ satisfies the condition, let $\sigma = \alpha_1 \alpha_1^* \alpha_2 \alpha_2^* \ldots \alpha_t \alpha_t^* \beta_1 \beta_2 \ldots \beta_s$ be a product of disjoint cycles where for all $i$, the $\alpha_i, \alpha_i^*$ are cycles of same even length and $\beta_i$ are cycles of odd length.
It suffices to find for all $i$ a square root $\sigma_i$ for $\alpha_i \alpha_i^*$ that moves the same elements $\alpha_i \alpha_i^*$ does and similarly a root $\tau_i$ for $\beta_i$ such that $\tau_i$ moves the same elements $\beta_i$ does. Then $\sigma = \tau^2$, where $\tau = \sigma_1 \sigma_2 \ldots \sigma_t \tau_1 \tau_2 \ldots \tau_s$.
If $\alpha_i = (a_1 a_2 \ldots a_{2k})$ and $\alpha_i^* = (a_1^* a_2^* \ldots a_{2k}^*)$, let $\sigma_i = (a_1 a_1^* a_2 a_2^* \ldots a_{2k} a_{2k}^*)$.
If $\beta_i = (a_1 a_2 \ldots a_{2k+1})$, then let $\tau_i = (a_1 a_{k+1} a_2 a_{k+2} a_3 a_{k+3} \ldots a_{k + (k+1)} a_{k+1})$.
For example, if $\sigma = (12)(34)(567)$, then $(12)(34) = (1324)^2$ and $(567) = (576)^2$, so $\sigma$ has a square root $\tau = (1324)(576)$.