If you want to install install ubuntu alongside windows 8.1 then follow below process to make your computer dual boot with windows and ubuntu.
If you are starting up with fresh machine, I prefer you to first install ubuntu in your machine then install windows.
If you have already installed windows in your machine and want to install ubuntu alongside windows 8.1 then follow below steps.
Insert bootable USB or DVD that contains Ubuntu select Something else option when below screen appears.
install ubuntu alongside windows 8.1
In next step choose partition you want to install ubuntu. Now after completing ubuntu installation you need to update grub loader with windows boot loader.
OR
If you have already installed ubuntu in your computer and you want to install windows 8/8.1 then boot your computer with windows bootable media like again USB or DVD and install windows. After completing windows installation recover grub boot loader to work both the operating systems.
Methods to repair grub loader-
Note:- Don’t forget to uncheck Turn on fast startup option in windows 8/8.1 settings before starting with grub loader repair.
To uncheck Turn on fast startup option go to Control Panel > Hardware and Sound > Power Options > System Settings > Choose what the power buttons do and uncheck the Turn on fast startup checkbox.
#1. You can recover boot loader using boot repair utility. This is a GUI based method to repair boot loader but it is not working some cases.
#2. I prefer you to use below commands on terminal after booting with ubuntu live DVD or USB.
a. Determine the partition in which ubuntu is installed. You can use GParted that comes with ubuntu live DVD.
partition table gparted
b. Mount this partition.(In this case ubuntu partition is /dev/sda5.)
sudo mount /dev/sda5 /mnt   #confirm that sda5 is correct!
c. Bind mount some other stuff also.
for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
d. chroot into installed ubuntu.
sudo chroot /mnt
e. Now update grub in installed ubuntu.
update-grub
f. If you got error in step e then follow this step
grub-install /dev/sda
update-grub
g. Now all set. Exit and Restart your computer.
exit
sudo reboot
Now you can enjoy with your dual boot computer.
Caution - Follow above listed methods at your own risk. It may cause data loss if you goes wrong in any step.