logistic regression - why exponent (log ratio) is linear I am new to ds and stats in general. I read numerous article to understand logistic regression. I got some idea why it works and how it fits to scattered plot of 1s and 0s when target variable is binary. however one piece of puzzle I still don't understand is how come someone derived that 

ln(p/1-p) = B0 + B1X1 + ..

I see all articles assume that this is the link function and then go on talking about how it solves our regression problem for binary variable. but how this link function came about.
p is a probability so it is strictly between 0 and 1. So ln(p/(1-p)) is:

for p = 0: ln(0/1) = -Inf

for p = 1: ln(1/0) = +Inf

So now you've rescaled the probability to +/- Inf. In the GLM framework you can use practically any function that scales probability to +/-Inf (see any GLM textbook, or https://stats.stackexchange.com/questions/20523/difference-between-logit-and-probit-models).

How did it come about? Well, mathematicians and statisticians realised they needed a function with the above properties, had a think, came up with a few, decided on the ones that had tractable asymptotic properties, explored how they worked with real data and decided the sensible ones were logit (as above), probit (see references) and a few others. Of course you should always test your model assumptions against your data, and choice of link is just another one of those assumptions, just like assuming linearity in a covariate.