What matters for GKs' rating is the number of saves they do. A GK with 4-5 saves will probably get an 8-9 while a GK with no saves will receive a 5-6. (This is assuming you don't set the gk to kick FKs, CKs or penalties so to get goals and assists)
For the rest of the players what is taken into account is tackling, intercepting, scoring, assisting etc. The more "active" they are in the match script, the better rating they will receive. Particularly for mcs orders have a big impact to their "script activity". ex. Attacking down both flanks usually results in a low rating for the central mc (if you use one).
Receiving yellow card(s) means -1 or -2 rating. A direct red could result in -2 or even -3 rating.
p.s. This is all based on my personal experience