When is it ever rational to enter a sweepstakes where you may have a 1/​10,000 chance of winning?

It may be free to enter the sweepstakes, but it costs time to enter the sweepstakes. So the time is the first part of the cost. Then you may also have monitoring costs as well (if you monitor the progress of the sweepstakes, which may also cost valuable time).
But at the same time, there are other sweepstakes where the time it takes to enter is virtually 0. This could result in additional time costs if it results in increased spam, however (which may not come with most sweepstakes, but which may come with some).
And, of course, you have to factor in the expected gain if you entered, say, 1000 sweepstakes in your life. Eventually, you get to the point where you may have a decent probability of winning something big by entering so many of them