Five-year sets of photometric and polarization observations are used to study the variability of the blazar OJ 287. A model with one constant and several variable sources of polarized radiation is considered. Monte-Carlo simulations are used to find the optimal source parameters providing the best agreement between the model and observed relations between the polarization parameters and intensity. The modeling results and four-color photometric data are used to find the spectra of the constant and variable components. Both spectra are power laws, but with different spectral indices. The observed color variability of the object is due to the difference of the color indices of these components and their different contributions to the total observed radiation. It is concluded that the observed variability of the polarization and colors of the blazar OJ 287 in the optical range can be explained with the model used.