This is a hard question because it is so general but i'll try (word of warning because it's a general question i'll sound very vague on a lot of my answers)
Overall:
1. Women are human too so they are attracted to specific things (preferences e.g. tall, a certain race etc.) but there are too many preferences woman by woman so you're better off ignoring the specific things
2. BUT women are also to general things in men (dominance, how desired he is by other women, social intelligence, willingness to walk away etc.) once again there are a lot of things here but you're better off learning the things women are attracted to generally and BRINGING them out in your own personality
IN THE END MANY THINGS ARE ATTRACTIVE TO WOMEN GENERALLY AND SPECIFICALLY BUT AS YOU'LL NEVER KNOW ALL THE SPECIFICS BETTER OFF FOCUSING ON THE GENERAL THINGS
Attraction is not the be all end all as if you can't get her comfortable first she won't be attracted
But to answer the question of how attraction works:
Men are lightswitches - we see it we want it or we don't
Women are like dimmers - they don't decide right away and if it goes down it can always come back up
Phew.. hope this helps