When do I write some time instead of sometime and sometimes?

Some time is a span of time:

Some time passed before she came in.

Sometime means at an unspecified time:

We should get together sometime.

Sometimes means at times:

Sometimes I'm so nervous I can't sleep.