f[x_] = If[x - Floor[x]> 1/2, -1, 1]

Plot[f[x],{x,0,5}]

b[n_] = 4/(n*Pi)

f1[x_] = b[1] Sin[2 Pi  x]

Plot[{f[x],f1[x]},{x,0,5}]

f3[x_] = b[1] Sin[2 Pi x] + b[3] Sin[ 2 Pi 3 x]

Plot[{f[x],f3[x]},{x,0,5}]

f5[x_] = Sum[b[n] Sin[2 Pi n x],{n,1,5,2}]

Plot[{f[x],f5[x]},{x,0,5}]

f13[x_] = Sum[b[n] Sin[2 Pi n x],{n,1,13,2}]

Plot[{f[x],f13[x]},{x,0,5}]

f101[x_] = Sum[b[n] Sin[2 Pi n x],{n,1,101,2}];

Plot[{f[x],f101[x]},{x,0,5}]