Define up[v][j] = the -th ancestor of node . This is the node you reach by jumping up steps from . For example, up[v][0] is the parent (jump step). up[v][1] is the grandparent (jump steps). up[v][3] is the th ancestor.
If you precompute this table, you can answer any -th ancestor query by decomposing into powers of and making at most jumps.