I remember peeking at the code when this was first introduced, it's a first meeting sort of deal where the game randomly assigns a number between 0 - 100 then it adds on bonuses for certain things, traits in common, career level, skills, wealth, then on top of those there are some moodlets which give a boost, fresh breath, smooth skin or nice nails from the spa and clean clothing. If you score over 110 I think it was you get the moodlet.
This is part of the reason why when you have played for a while with a sim and got them a good job, nice house and some skills the whole world thinks they are attractive, but chances are their actual spouse who you created or who they met before they learnt anything or had a good job and money doesn't
If it was just traits, zodiac and favourites I feel it would be a little more logical, I have sims who are totally besotted with each other it's obvious just to watch the autonomous behaviour but to the attraction system they have more in common with some random townie they never said a word to. It actually doesn't even recognise favourites.