Spectral window when FFT is not a power of 2
500 is an exact integer multiple of the period of the cosine function used in your raised cosine window.  Therefore there are zeros in the spectrum at all multiples of the cosine's frequency (due to those basis vectors being exactly orthogonal).  512 is not an integer multiple of that cosine's period, so none of the correlations against the DFT basis vectors of a 512 length FFT will be zero (just small).  Thus the difference between the two spectrums.