"Plate appearances" is simple. It literally means how many times the batter has come to the plate, no matter the result that ensues.
Edit (one exception) : If an inning ends, while batter is up, from a runner getting out (picked off, caught stealing, etc) then that won't count as a PA. The plate appearance has to "finish" (ie. hit, strikeout, walk, ground or fly out, sac fly, etc etc etc) to count.
It's calculating what are considered "at bats" that's complicated