If you want to get a list of Office 365 users with a specific license type you could go to the license overview in the portal and check your licenses there. Simply select the license you are interested in.

This will list the users on your screen. There is an export button on top if you want to export the shown data.

To do the same via Powershell and get a nicely formatted export or do more fancy things you do the following.
Connect to Office 365 via Powershell. If this doesn’t work, please follow the installation instructions.
Connect-MsolService
Get a list of the licenses in your Office 365 tenant:
Get-MsolAccountSku
This will provide an overview comparable to what you can find in the portal.

Please note that the AccountSkuId is the internal name of the license. It does not match the commercial name of the license. Here are a few common names and their translations:
AccountSkuId | Commercial name |
STANDARDPACK | OFFICE 365 E1 |
ENTERPRISEPACK | OFFICE 365 E3 |
ENTERPRISEPREMIUM | OFFICE 365 E5 |
DESKLESSPACK | OFFICE 365 F3 |
EXCHANGESTANDARD | EXCHANGE ONLINE (PLAN 1) |
To get the desired list of users with a certain license, you need to look up the AccountSkuId in your overview and provide it like this:
Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId -match "ENTERPRISEPACK"}
Replace ENTERPRISEPACK with (unique part of) the AccountSkuID you’re trying to filter by.