This step by step how-to will help you to install OS (Raspbian Jessie) on your Raspberry Pi, i have selected Raspbian Jessie for this purpose. this how-to also include Wi-Fi settings without connecting display to raspberry pi.

Installing Linux OS (Raspbian Jessie) on Raspberry Pi

Easiest cross-platform way to install Linux on your Raspberry Pi is using the NOOBS installer, but we are installing Raspbian using diskimager utility.

Go to the Raspberry Pi download page
Download the Raspbian zip file.
Download the Win32DiskImager utility from the Sourceforge.
Run Win32DiskImager as administrator.
Select the image file you downloaded earlier. Select the drive letter of the SD card in the device box. “Select the correct drive; if you get the wrong drive you can destroy the data on your computer.”
Click Write and wait for the process to complete. Exit the imager and eject the SD card.

WiFi Connection Settings

Setup Wi-Fi connection without connecting any display to raspberry pi, just simply create a text file and call it wpa_supplicant.conf and place into the /boot/ folder and add following contents to this file.

Wifi Settings for Raspbian Jessie

WiFi Settings for Raspbian Stretch

Make sure you change country code to yours (Thanks to @Clumpton for sharing this)

Enable SSH

SSH is disabled by default you need to enable it work with Raspberry pi without monitor, keyboard and mouse connected all the time, simply create text file and call it ssh and place it in /boot/ on SD card (please make sure file extension isn’t txt).
Put the SD card in your Raspberry Pi and boot it.

The default login credentials for the image are username pi and password raspberry. We’ll can change the password in the next step.

Configuring your System

If you have an Ethernet cable connected or your Wi-Fi settings were correct you can SSH into the Pi to begin your configuration. By default the Ethernet port is set to dynamic IP address using DHCP.

It is highly recommended to change default password for pi user, to do so you need to issue following command

While we are at users we need to set password for root and allow root login via ssh, lets change root password by issuing following command

Enable root login via remote ssh issue following command and make following changes

Now press CTRL + O and hit return to save changes. Now press CTRL + X to exit.

Now restrat ssh service or you can reboot the pi with reboot command.

After reboot try to ssh to raspberry pi using root credentials.