How long does it take from the application for a professorship to the invitation to a lecture? On average, how long does it take from applying for a professorship to being invited to a lecture, provided that one is actually invited?

I am referring to an application for W2/W3 professorships in Germany (both Fachhochschulen and regular universities).

And what is the time before the lecture: "Hey, you're invited for next Monday"? or a little more time?
I can offer a few data points here: being somewhat OCD, I've kept a log of all applications I've sent out over the years. Keep in mind that this mostly refers to computer science departments at German universities, but I guess it won't be wildly different for other departments.

So between 2015 and 2020, I've sent out 37 applications for W2/W3 (and some W1 tenure-track) professorships. Of these, I've only ever gotten an official response of any kind for 22 applications, which is a bit sad IMHO. 

Anyway, the median time for these responses was 90.5 days, with a minimum of 25 days (for a "sorry, not interested" response) and a whopping maximum of 247 days (for a "sorry, we've hired someone else" response).

Last but not least, I was invited for an interview in 9 out of these 22 cases. Here, the median response time was 41 days, with a minimum of 33 days. 

Based on this data, my rule of thumb is that if you haven't gotten any response to an application after two months, then you can assume they are not interested.

P.S. I didn't keep a record of how long I had until the interview after the invitation, but it was never less than three weeks, usually rather 4-6 weeks.