The number 501 is from Diogenes Laertius.  There is no earlier account which gives the exact number.  We know that 500 was the size of a typical jury; but we also know that the number in some cases went as high as 2000.  There was no problem in the case of a tie, because a tie meant acquittal.  (Trials weren't always held in a room; they were sometimes held in the open air; so there was never a problem of fitting jurors into a room.)  From Plato's Apology 36a, we know the ratio (but not the exact numbers) of jurors who voted for and against conviction.