Step 1: Write required integrals.
Using reduction formula,
\[
I_n=\frac{\tan^{n-1}x}{n-1}-I_{n-2}
\]
We get,
\[
I_0=x
\]
\[
I_1=\log(\sec x)
\]
\[
I_2=\tan x-x
\]
\[
I_3=\frac{\tan^2x}{2}-\log(\sec x)
\]
\[
I_4=\frac{\tan^3x}{3}-\tan x+x
\]
\[
I_5=\frac{\tan^4x}{4}-\frac{\tan^2x}{2}+\log(\sec x)
\]
\[
I_6=\frac{\tan^5x}{5}-\frac{\tan^3x}{3}+\tan x-x
\]
Step 2: Substitute in the given expression.
\[
I_0+I_1+2I_2+2I_3+2I_4+I_5+I_6
\]
On simplifying, the \(x\) terms and logarithmic terms cancel.
The remaining expression becomes
\[
\tan x+\frac{\tan^2x}{2}+\frac{\tan^3x}{3}+\frac{\tan^4x}{4}+\frac{\tan^5x}{5}
\]
Step 3: Compare with the given summation.
\[
\sum_{k=1}^{n}\frac{\tan^k x}{k}
=
\tan x+\frac{\tan^2x}{2}+\frac{\tan^3x}{3}+\cdots+\frac{\tan^n x}{n}
\]
Comparing, the last term is
\[
\frac{\tan^5x}{5}
\]
Therefore,
\[
n=5
\]
Step 4: Final conclusion.
Hence,
\[
\boxed{5}
\]