In Portal 2, Chell awakens and hears that 9999... years have passed. The surface is just a wide field. Is she the last person on earth?
Is she the last person alive...
No. There are plenty of additional test-subjects that are uncovered at the end of the co-op campaign
on [the surface of the] earth?
Nobody really knows. Killing everyone on the planet is quite difficult, and the ending of the Half-Life series (as the two exist in the same universe, but vastly separated in time when Portal 2 occurs) would probably provide the best answer. I would assume that the Good Guys win, so people will still be around, but who knows how many or where they're at?
GLaDOS also mentions at one point she's been to the surface and seen lots of humans - but won't need them as she has Chell.
It could have been from a solar flare, nuclear war, or anything that can take out humans but leave Earth's details like continental shifts. Because at the end of Portal 2 there is still land above the Aperture Science labs.
Yes there ARE people left on the surface. At the end of Portal 2 you leave the elevator and are confronted with fields of wheat. Wheat fealds are quickly over run by weeds when left unattended. As there isn't a single weed in the fields then there must be people left alive to tend to them......