The rubbing between your body and the blanket causes many electrons to be transferred, thus causing the development of a relatively high excess charge on the blanket and an equal charge with the opposite sign on your body.
If you get close enough to the blanket with an exposed part of your body, the electrons you exchange with the blanket will return to the original object through a spark. But only if the potential difference between the two parts is high enough to ionize the air between them. Read more