Klaviyo tracks all this internally and you can easily see stats on mailing list signups, etc. I daresay there’s an API to export that data if you need to.
If I’ve misunderstood your question, though, and this is more about tracking or processing the sign-up, then:
If you need to do some processing on the account that just subscribed, then you could use a webhook to trap the sign-up event, get the data related to it sent to a URL you set up, and then you can do what you want with it.
https://developers.klaviyo.com/en/docs/how_to_add_a_webhook_action_to_a_flow
If you need to carry out processing while the user is filling out the sign-up form, then in that case I’d be tempted to do my own form so I have total control and total visibility of what’s happening with it, and then use Klaviyo’s API to submit a subscribe event. (This is how I handle mailing list signups as part of the checkout process.)
https://developers.klaviyo.com/en/reference/subscribe_profiles
If you mean via JavaScript, you can run custom code when a form is submitted, and fetch the email input.
https://developers.klaviyo.com/en/docs/track_klaviyo_form_activity_using_javascript