Which tense: the same test as French
The choice of tense works like the French one. Passato prossimo is for completed events that move things along - ho mangiato, siamo partiti. Imperfetto is for the background: habits, weather, age, description, and whatever was going on when something else cut across it - faceva freddo, lavoravo, aveva vent'anni.
Essere or avere
Then the auxiliary. Most verbs take avere, but verbs of movement and change of state take essere - andare, venire, nascere, morire, diventare, restare - and so do all reflexives. With essere the participle agrees with the subject: lei è andata, loro sono andati. With avere it normally does not.
When the auxiliary changes the meaning
A handful of verbs take either, and change meaning as they do. Ho corso means I ran; sono corso means I ran somewhere. The auxiliary is carrying information rather than being arbitrary, which is worth knowing before you conclude the system is decorative.
The third past tense, and where you hear it
One thing no textbook warns you about: there is a third past tense, the passato remoto, and where you are decides whether you hear it. In the north it is largely confined to writing, but in much of the south it is ordinary spoken usage for completed events. Neither is wrong.
Signal words that point to a tense
When the test feels abstract, the surrounding words often decide for you. Di solito, sempre, ogni giorno and mentre lean towards the imperfetto, because they describe habits or something in progress: da bambino andavo al mare ogni estate. Ieri, una volta, all'improvviso, tre volte and alle otto lean towards the passato prossimo, because they pin an event to a moment or count it. The trap is duration. Ho lavorato lì per due anni takes the passato prossimo even though two years sounds like background, because the period is closed and you are summing it up. If you could put a full stop after it, it is a completed event.
Agreement with object pronouns
Avere normally leaves the participle alone, but there is one rule worth learning early. When a direct object pronoun - lo, la, li, le - comes before the verb, the participle agrees with it: hai visto Maria? Sì, l'ho vista. Hai comprato i biglietti? Sì, li ho comprati. The same happens with ne when it refers to a quantity: ne ho mangiate tre, talking about pizzas. Getting this right is one of the clearest signs that someone has moved past beginner Italian, and it costs nothing once the pattern is in your ear. With mi, ti, ci and vi the agreement is optional, so you will hear both.
Modal verbs and the weather
Two smaller groups cause hesitation. Dovere, potere and volere usually borrow the auxiliary of the verb that follows them: ho dovuto lavorare, but sono dovuto partire, because partire takes essere. In everyday speech ho dovuto partire is also common and accepted, so this is a refinement rather than a trap. Weather verbs are similarly relaxed: è piovuto and ha piovuto are both correct, and you will hear each. The practical upshot is that for these verbs you can stop worrying. Spend your attention on the core list of movement and change-of-state verbs instead, because that is where a wrong auxiliary genuinely sounds foreign.